Re: Visual artifacts left in command line when text scrolled

2013-10-08 Thread Thorsten Glaser
Chris Sutcliffe dixit:

Thanks for the offer, below is my ps1 prompt based on the latest
dot.mkshrc example where I'm trying to change the return code to red:

OK, we can do this even without uu as it contains no magic chars.

Use something like this:

(( e ))  REPLY+=$'\1\e[31m\1'$e|$'\1\e[0m\1'

Maybe \e[1;31m for bold red…

bye,
//mirabilos
-- 
[ Natureshadow über meine Tendenz, seine IRL-Aussprüche zu siggen ]
(er) „Du bist besser als Twitter“
(ich) „Wieso? Weil ich das Wichtige herausfiltere?“
(er) „Und weil Du einfacher zu bedienen bist“


Re: Visual artifacts left in command line when text scrolled

2013-10-08 Thread Thorsten Glaser
Chris Sutcliffe dixit:

Does it have something to do with the escape sequences being used inside

Oh, ouch.

(( e ))  REPLY+=$'\''\1\e[31m\1'\''$e|$'\''\1\e[0m\1'\''

an inline function?

It’s not a function, it’s a single-quoted string… at that time, anyway.
Sorry about that.

bye,
//mirabilos
-- 
22:20⎜asarch The crazy that persists in his craziness becomes a master
22:21⎜asarch And the distance between the craziness and geniality is
only measured by the success 18:35⎜asarch Psychotics are consistently
inconsistent. The essence of sanity is to be inconsistently inconsistent


Re: Visual artifacts left in command line when text scrolled

2013-10-05 Thread Thorsten Glaser
Chris Sutcliffe dixit:

Not sure if my mailer killed the escape sequences or not, but I don't see
any '\r' in the example you provided.

OK, then let’s send the stuff either uuencoded, or use the
generic $'…' escaping form.

to colour the return code red, if I understand correctly, I should do:

   (( e ))  REPLY+=\001[31m\001$e|

No.

To colour something red, you send:
ESC [ 3 1 m

To “escape” something from being counted for the prompt width,
you wrap it (on both sides) in a byte that tells mksh to ignore
it. The byte you must define yourself, but it must be something
not otherwise used in the prompt text. You do that by using it
as first byte of the PS1 and ASCII CR as second byte of it.

The manpage even has got examples on how to do that, as does
dot.mkshrc (minus actually using colourising).

So how about, you send me the prompt you want to have, possibly
with colourising, as uuencode, and I’ll send it back? (You can
also send it in GNU bash syntax…)

bye,
//mirabilos
-- 
[ Natureshadow über meine Tendenz, seine IRL-Aussprüche zu siggen ]
(er) „Du bist besser als Twitter“
(ich) „Wieso? Weil ich das Wichtige herausfiltere?“
(er) „Und weil Du einfacher zu bedienen bist“