Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#echo doesn't work right in {SEND OUTPUT} event. (TinTin++ 2.02.20) #144

Closed
msocorcim opened this issue Nov 30, 2022 · 1 comment
Closed

Comments

@msocorcim
Copy link

#event {SEND OUTPUT}
#EVENT {SEND OUTPUT}
{
#format {lineout} {%p} {%0};
#echo {<199>SENT:<099> %s} {$lineout} ;
#unvariable {lineout}
}
/* expected behavior: */
look
SENT: look

#EVENT {SEND OUTPUT}
{
#format {lineout} {%p} {%0};
#echo {<199>SENT:<099> %s <199>MORE TEXT<099>} {$lineout} ;
#unvariable {lineout}
}

/* unexpected behavior: /
look
MORE TEXT
/
expected behavior would have been: */
look
SENT: look MORE TEXT

/* outside of the event, #echo works as expected */
#echo {<199>SENT:<099> %s <199>MORE TEXT<099>} {testing output}
SENT: testing output MORE TEXT

@scandum
Copy link
Owner

scandum commented Dec 1, 2022

It's somewhat explained in #help event

SEND OUTPUT            %0 raw text %1 size

%0 contains the raw text, which includes the \r\n newline sequence.

One thing you could do is:

#EVENT {SEND OUTPUT}
{
    #format {lineout} {%p} {%0};
    #replace lineout {\r\n} {};
    #echo {<199>SENT:<099> %s <199>MORE TEXT<099>} {$lineout} ;
    #unvariable {lineout}
}

In the latest beta however #format %p will strip trailing newlines. So if you were expecting %p to strip new lines, that has been fixed.

@scandum scandum closed this as completed Dec 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants