[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] Fixed regexec() memory leak

From: David Lawrence Ramsey
Subject: Re: [Nano-devel] Fixed regexec() memory leak
Date: Sat, 15 Nov 2003 17:09:21 -0800 (PST)

Mike Frysinger:
>On Thursday 13 November 2003 14:51, David Lawrence Ramsey wrote:
>> I've looked into it some more, and on my box, nano 1.2.x and 1.3.x
>> always print out stuff when I run them in xterms and use Ctrl-[arrow
>> key] (regardless of whether I use --keypad with 1.2.2 or not).  At
>> the console, however, Ctrl-[arrow key] acts like [arrow key] in both
>> versions.  What terminal are you running nano in in these cases?
>i normally use Eterm (thus TERM=Eterm) but i also tested it on a
>virtual console (TERM=linux) and got the same results ...
>that is can hold ctrl and use the arrow keys

Okay.  For comparison purposes, I've tried running nano 1.3.0-cvs in
eterm and I've figured out the following with regard to eterm 0.9.2 when
$TERM is "Eterm":

Ctrl-up arrow: ^[ o a [Acts like Meta-O and prints "a" afterwards.]

Ctrl-down arrow: ^[ o b [Same as above, but prints "b".]

Ctrl-right arrow: ^[ o c [Same as above, but prints "c".]

Ctrl-left arrow: ^[ o d [Same as above, but prints "d".]

Home, Ctrl-Home: ^[ [ H [Acts like ^[, which does nothing, and prints
"H" afterwards.]

End, Ctrl-End: ^[ [ F [Same as above, but prints "F".]

Ctrl-PageUp: ^[ [ 5 ^ [Same as above, but prints "5^".]

Ctrl-PageDown: ^[ [ 6 ^ [Same as above, but prints "6^".]

delete: ^? (in both nano and shell prompt) [Acts like backspace with
current CVS; is ignored in 1.3.0.]

I've noticed that if I set $TERM to "xterm", Ctrl-[arrow key] acts like
[arrow key], and everything else acts the same as before.  Does it
change anything on yours?  Also, Ctrl-[arrow key] acts like [arrow key]
in a virtual console on my box.  Apparently it's another difference
between your terminal and mine, and I'm not sure how to fix it on yours.

Are the "a, b, c, d" items mentioned above what you meant before by
nano's printing out stuff?  (I should have asked about that earlier.) 
When I was talking about that in xterm, I was referring to "1;5A 1;5B
1;5C 1;5D", which is what I was getting there.

The reason for the printed data is because Ctrl-[arrow key] generates
escape sequences in eterm when $TERM is "Eterm", and nano 1.3.x doesn't
handle any escape sequence but the one generated by Delete on certain
broken FreeBSD terminals in an xterm, and that same sequence means
Delete on many other terminal types as well.

The reasons for the lack of escape sequence support in 1.3.x are (a)
having to handle both escape sequences and keypad values at the same
time made things very messy input-wise, (b) most escape sequences mean
entirely different things on different terminal types (e.g, the
sequences for PageUp and PageDown on FreeBSD are the same as the
sequences for F10 and F9 on the Mach console) and are hence impossible
to handle consistently without ugly terminal-specific hacks, (c) if
keypad mode isn't turned on, mouse input won't work at all, and (d) more
things were broken on the aforementioned FreeBSD boxes when keypad input
was off than when it was on.  So, basically, dropping support for escape
sequences except in cases of breakage makes things on the whole work
better than otherwise.  Aside from setting $TERM to xterm in eterm, I
don't know what else to do, since if nano were to support the escape
sequences, they'd have to be changed every time they were changed in
eterm's terminfo file.

As for the other issues with eterm, at the very least Home, End, and
Delete should all be generating the keypad values KEY_HOME, KEY_END, and
KEY_DC instead of escape sequences, since keypad input is on.

Sorry for the lack of real solutions, but I don't know why your terminal
behaves differently from mine.  What version of ncurses (and hence its
terminfo files) are you using?  I'm using 5.3.

Sluggy.Net: The Sluggy Freelance Community!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]