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

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

July 21, 2003 09:48
[perl #23075] Wrong linewrap in Term::ReadLine::Perl with EDITOR=vi
Message ID:
# New Ticket Created by 
# Please include the string:  [perl #23075]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from,
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

The problem is in Term/ReadLine/, 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]
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:
    osname=linux, osvers=2.2.19-6.2.16, archname=i686-linux
    uname='linux 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
    cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    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/, so=so, useshrplib=false, libperl=libperl.a
  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:

Environment for perl v5.8.0:
    LANGUAGE (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)
    SHELL=/bin/zsh Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About