perl-term.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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.14/Gnu/XS.pm
  9. --- Term-ReadLine-Gnu-1.14/Gnu/XS.pm.orig 2002-07-28 05:41:36.000000000 +0200
  10. +++ Term-ReadLine-Gnu-1.14/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. }