develooper Front page | perl.perl5.porters | Postings from July 2003

[perl #23075] Wrong linewrap in Term::ReadLine::Perl with EDITOR=vi

From:
perlbug-followup
Date:
July 21, 2003 09:48
Subject:
[perl #23075] Wrong linewrap in Term::ReadLine::Perl with EDITOR=vi
Message ID:
rt-23075-61589.1.39686755816868@rt.perl.org
# New Ticket Created by  hjp@teal.hjp.at 
# Please include the string:  [perl #23075]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=23075 >



This is a bug report for perl from hjp@teal.hjp.at,
generated with the help of perlbug 1.34 running under perl v5.8.0.


-----------------------------------------------------------------
[Please enter your report here]

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




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About