You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

52 lines
2.1 KiB

I don't know why, but under some circumstances (usually in an SSH
session within an xterm), Term::ReadLine::Gnu things that a TERM=xterm
does not provide the "le" sequence. OTOH the "cr" and "ce" sequences are
fully enough for the task of providing a password/shadow style prompt.
So, for positioning the cursor in the middle of the prompt, instead of
using left-spacing we just redraw (over the full line) the part of the
line left to the cursor.
Index: Term-ReadLine-Gnu-1.20/Gnu/XS.pm
--- Term-ReadLine-Gnu-1.20/Gnu/XS.pm.orig 2002-07-28 05:41:36.000000000 +0200
+++ Term-ReadLine-Gnu-1.20/Gnu/XS.pm 2004-03-12 17:55:16.000000000 +0100
@@ -429,21 +429,20 @@
print $OUT ($_tstrs[0], # carriage return
$_tstrs[1], # clear to EOL
$prompt, '*' x length($Attribs{line_buffer}));
- print $OUT ($_tstrs[2] # cursor left
- x (length($Attribs{line_buffer}) - $Attribs{point}));
+ print $OUT ($_tstrs[0], # carriage return
+ $prompt, '*' x $Attribs{point});
$oldfh = select($OUT); $| = 0; select($oldfh);
}
sub _tgetstrs {
my @s = (tgetstr('cr'), # carriage return
- tgetstr('ce'), # clear to EOL
- tgetstr('le')); # cursor left
- warn <<"EOM" unless (defined($s[0]) && defined($s[1]) && defined($s[2]));
+ tgetstr('ce')); # clear to EOL
+ warn <<"EOM" unless (defined($s[0]) && defined($s[1]));
Your terminal 'TERM=$ENV{TERM}' does not support enough function.
Check if your environment variable 'TERM' is set correctly.
EOM
# suppress warning "Use of uninitialized value in print at ..."
- $s[0] = $s[0] || ''; $s[1] = $s[1] || ''; $s[2] = $s[2] || '';
+ $s[0] = $s[0] || ''; $s[1] = $s[1] || '';
$_tstrs_init = 1;
return @s;
}
Index: Term-ReadLine-Gnu-1.20/Gnu.xs
--- Term-ReadLine-Gnu-1.20/Gnu.xs.orig 2009-02-27 13:44:41 +0100
+++ Term-ReadLine-Gnu-1.20/Gnu.xs 2009-03-30 22:15:36 +0200
@@ -233,6 +233,10 @@
static void rl_echo_signal_char(int sig){}
#endif /* (RL_VERSION_MAJOR < 6) */
+#define xmalloc readline_xmalloc
+#define xrealloc readline_xrealloc
+#define xfree readline_xfree
+
/*
* utility/dummy functions
*/