reset after binary data
Martin von Gagern
Martin.vGagern at gmx.net
Fri Aug 10 01:04:28 CEST 2007
Hi!
This happened to me several times now, that I cat some file I expect to
be text but which proves to be binary. With urxvt this usually has the
following effects:
1. reverse video, which in my case gives me black text on dark pixmap
2. symbols and digits on the prompt I didn't enter there
I've known other terminals to be in some garbled state after binary data
as well, e.g. using some line drawing chars instead of letters. In such
cases I've always entered "reset" blindly, and that was that. However
rxvt-unicode doesn't seem to reset the reverse video setting on reset.
I've plugged together a small demo, which should manage to reproduce
this issue almost everywhere. This is one single command, for you to
copy and paste.
env -i DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY \
urxvt -name urxvt-debug-mvg -bg 0 -fg 7 -vb -fade 30 \
-pixmap /usr/include/X11/pixmaps/monitor.xpm -e \
bash --noprofile --norc -c 'read -p Start?;
base64 -d <<<B8BGbugwTi5ezp8Gz2wnMaPJOwUmSopLvjCya/kkXRYbp7Y1tOUbYw==;
read -p "About to reset.";
reset;
read -p Again?;
base64 -d <<<B8BGbugwTi5ezp8Gz2wnMaPJOwUmSopLvjCya/kkXRYbp7Y1tOUbYw==;
read -p Done.'
First comes an invocation of env, to ensure no environment settings can
interfere, and it has nothing to do with Unicode. Then comes urxvt, with
a unique name so it will only use the settings provided on the command
line. I hope you have that pixmap, otherwise substitute an arbitrary one
or none at all. As command to run comes bash, with absolutely no profile
settings so escapes in the prompt won't interfere. Then the small demo
bash script, leading you through the steps, waiting for keypress at each
read. The base64 encoded data is a fragment from my /dev/urandom that
exposes both the issues and looks like this in hex:
07 c0 46 6e e8 30 4e 2e 5e ce 9f 06 cf 6c 27 31 |..Fn.0N.^....l'1|
a3 c9 3b 05 26 4a 8a 4b be 30 b2 6b f9 24 5d 16 |..;.&J.K.0.k.$].|
1b a7 b6 35 b4 e5 1b 63 |...5...c|
My request now is most specifically to have the reset command reset the
reverse video mode as well.
If you find the time, some general improvements in handling of binary
data vs. escape sequences would be great. Maybe there are some more
possible welformedness checks for escape sequences. I could imagine some
kind of heuristics, like ignoring every simple but presumably valid
escape sequence if the preceding escape did not introduce a welformed
sequence. Probably this would be a feature some users would want to
deactivate, so a switch for it might be a good idea.
So much for today. Greetings,
Martin von Gagern (MvG on irc.freenode.net)
P.S.: Have a look at http://bugs.gentoo.org/188269 - an urxvt bug?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://lists.schmorp.de/pipermail/rxvt-unicode/attachments/20070810/a0be359d/attachment.sig>
More information about the rxvt-unicode
mailing list