Skip Menu |

This queue is for tickets about the Term-ReadLine-Perl CPAN distribution.

Report information
The Basics
Id: 74466
Status: new
Priority: 0/
Queue: Term-ReadLine-Perl

People
Owner: Nobody in particular
Requestors: jkeenan [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [RT #23075] Wrong linewrap in Term::ReadLine::Perl with EDITOR=vi
Reviewing older tickets in the Perl 5 bug queue tonight, I came across this ticket originally filed in July 2003: https://rt.perl.org/rt3/Ticket/Display.html?id=23075. ##### Requestor: hjp@teal.hjp.at When the environment variable EDITOR is set to vi, and Term::ReadLine::Perl is used, the cursor is left at the wrong position after the user hits return in insert mode. Instead of at the first position of the next line, it is at the last position of the previous line. The problem is in Term/ReadLine/readline.pm, in sub F_AcceptLine (ca. line 1890). It prints "\r\n" to $term_OUT. But this function is called from do_command, which is called *before* redisplay() in the loop of sub readline (ca. line 1480). redisplay doesn't expect any other function to mess up the cursor position, thus the display becomes confused. This is visible only in vi insert mode, because in all other modes the last call to redisplay() doesn't produce any output. Fix: Move the print $term_OUT "\r\n"; from F_AcceptLine to the end of readline, just before or after the call to &ResetTTY; [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=library severity=low --- Site configuration information for perl v5.8.0: Configured by hjp at Sun Oct 27 22:30:13 CET 2002. Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: Platform: osname=linux, osvers=2.2.19-6.2.16, archname=i686-linux uname='linux teal.hjp.at 2.2.19-6.2.16 #1 wed mar 13 14:04:29 est 2002 i686 unknown ' config_args='-ds -e' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2', cppflags='-fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt -lutil perllibs=-lnsl -ldl -lm -lc -lposix -lcrypt -lutil libc=/lib/libc-2.1.3.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.1.3' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Locally applied patches: --- @INC for perl v5.8.0: /usr/local/lib/perl5/5.8.0/i686-linux /usr/local/lib/perl5/5.8.0 /usr/local/lib/perl5/site_perl/5.8.0/i686-linux /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl . --- Environment for perl v5.8.0: HOME=/home/hjp LANG=en_US.iso885915 LANGUAGE (unset) LC_COLLATE=POSIX LD_LIBRARY_PATH=/home/hjp/wrk/a840/a840sw/ia32/lib:/usr/local/lib LOGDIR (unset) PATH=/home/hjp/bin:/usr/local/sbin:/usr/local/bin:/usr/lib/majordomo/bin:/usr/local/rrdtool-1.0.35/bin:/usr/sbin:/sbin:/var/qmail/bin:/usr/local/j2sdk1.4.1/bin:/usr/bin/X11:/bin:/usr/bin:/usr/games:/usr/X11R6/bin PERL_BADLANG (unset) SHELL=/bin/zsh Here is a patch: --- /usr/lib/perl5/site_perl/5.6.1/Term/ReadLine/readline.pm Sat May 25 03:21:12 2002 +++ /usr/local/lib/perl5/site_perl/5.8.0/Term/ReadLine/readline.pm Mon Jul 21 15:57:05 2003 @@ -1489,6 +1489,7 @@ &redisplay(); $LastCommandKilledText = $ThisCommandKilledText; } + print $term_OUT "\r\n"; undef @undo; ## Release the memory. &ResetTTY; ## Restore the tty state. @@ -1879,7 +1880,6 @@ &add_line_to_history; $AcceptLine = $line; local $\ = ''; - print $term_OUT "\r\n"; } sub add_line_to_history ##### Given the age of the report, the problem may have been resolved or the patch may no longer apply. In any case, since Term-Readline-Perl is no longer maintained by P5P, I am transferring the report here. Thank you very much. Jim Keenan