perl-term.patch 2.1 KB

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