Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri May 16, 2008 4:47 pm
Using #psub to put in a linefeed |
I am trying to do some substitution using #psub, and finding a minor problem. I want to put a linefeed in the middle of the text. As an example, the mud sends:
Code: |
Some long description blah blah blah which wraps
in the middle. More text.
The next line.
|
and I want it to come be displayed as:
Code: |
Some long description blah blah blah which wraps
in the middle.
More text.
The next line.
|
This is working fine. The problem is if the line from the mud is short enough that cmud doesn't wrap it:
Code: |
Short description with no wrap. More text.
The next line.
|
When I put the linefeed in, I get this:
Code: |
Short description with no wrap.
More text. The next line.
|
Is this a bug? Does anyone have a suggestion? What I'm doing is a bit more complex than that, of course. Here is some sample code, which would be within a trigger for "More text." The problem only shows up if cmud isn't wrapping the initial text.
Code: |
$line = %line
#call %match($line, "(*) (More text.)(*)", $d1, $d2, $d3)
$line = %concat($d1,$d3%lf,$d2)
$extra = $d2
#if %match($line, "(*) (Other text.)(*)", $d1, $d2, $d3) {$line = %concat($d1,$d3);$extra = %concat($extra,%lf,$d2)}
$out = %concat($line,%lf,$extra)
#psub $out
|
|
|