Discussion:
duplicated characters on screen when changing 'columns'
Yakov Lerner
2004-07-20 19:36:38 UTC
Permalink
I think this is bug in vim. This can be observed in terminal emulator
which does not resize window width when you 'set columns=N'
to a lower value. One such terminal terminal emulator is gnome-terminal.
If you don't have gnome-terminal, you can also observe it in xterm if
you set TERM to vt100 ( TERM=vt100 will cause vim not to resize xterm's
window).

I noticed this in real editing when using multi-tabbed gnome-terminal. The
gnome-terminal had with of 200 columns but I wanted to watch for my long
lines
and I set 'set solumns=80', and I noticed this thing.

To reproduce:
1. open either gnome-terminal, or open xterm and set TERM to vt100.
2. vim -U NONE -u NONE
3. :set laststatus=2 " just for visibility
4. insert this line longer than 80 chars:
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
5. :set columns=40
6. Now the vim is using only 40 columns witdth out of 80 width
of terminal window, but the terminal emulator does not
resizes its window (see #1).
7. You'll notice that the last character in long wrapped lines
is "ghost" character, replicated and drawn past 40-th column.

Yakov
Ilya Sher
2004-07-20 18:53:41 UTC
Permalink
Yakov Lerner wrote:
| I think this is bug in vim. This can be observed in terminal emulator
| which does not resize window width when you 'set columns=N'
| to a lower value. One such terminal terminal emulator is
gnome-terminal.
| If you don't have gnome-terminal, you can also observe it in xterm if
| you set TERM to vt100 ( TERM=vt100 will cause vim not to resize
xterm's
| window).
|
| I noticed this in real editing when using multi-tabbed
gnome-terminal. The
| gnome-terminal had with of 200 columns but I wanted to watch for
my long
| lines
| and I set 'set solumns=80', and I noticed this thing.
|
| To reproduce:
| 1. open either gnome-terminal, or open xterm and set TERM to vt100.
| 2. vim -U NONE -u NONE
| 3. :set laststatus=2 " just for visibility
| 4. insert this line longer than 80 chars:
|
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

|
| 5. :set columns=40
| 6. Now the vim is using only 40 columns witdth out of 80 width
| of terminal window, but the terminal emulator does not
| resizes its window (see #1).
| 7. You'll notice that the last character in long wrapped lines
| is "ghost" character, replicated and drawn past 40-th column.
|
| Yakov
|

Confirmed for:
# gnome-terminal --version
Gnome gnome-terminal 2.6.0

# X -version

XFree86 Version 4.4.0
Release Date: 29 February 2004
X Protocol Version 11, Revision 0, Release 6.6
Build Operating System: Linux 2.6.6 i686 [ELF]
Current Operating System: Linux c15 2.6.7 #2 Wed Jun 16 11:34:30 IDT
2004 i686
Build Date: 12 June 2004
Changelog Date: 29 February 2004
~ Before reporting problems, check http://www.XFree86.Org/
~ to make sure that you have the latest version.
Module Loader present

# env
HOSTNAME=c15
SHELL=/bin/bash
TERM=xterm
HISTSIZE=1000
WINDOW_MANAGER=sawfish
WINDOWID=6291518
QTDIR=/usr/lib/qt-3.3
USER=ilya
LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
KDEDIR=/usr
PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/ilya/bin
MAIL=/var/spool/mail/ilya
PWD=/home/ilya
INPUTRC=/etc/inputrc
LANG=en_US.UTF-8
PS1=[\A \u@\h \w]#
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
HOME=/home/ilya
SHLVL=5
LOGNAME=ilya
LESSOPEN=|/usr/bin/lesspipe.sh %s
CVSEDITOR=vim
DISPLAY=:0.0
G_BROKEN_FILENAMES=1
COLORTERM=gnome-terminal
XAUTHORITY=/home/ilya/.Xauthority
_=/bin/env

And other values for 'columns'.



I could try to dig into the code but I'm not
sure when I'll have some spare time. _Might_ be
the problem is in gui.c around line 1111:

text_area_width = gui.num_cols *
gui.char_width + gui.border_offset * 2;

The " + gui.border_offset * 2" looks suspicious to me...
Ilya Sher
2004-07-21 05:10:37 UTC
Permalink
Ilya Sher wrote:

| I could try to dig into the code but I'm not
| sure when I'll have some spare time. _Might_ be
| the problem is in gui.c around line 1111:
|
| text_area_width = gui.num_cols *
| gui.char_width + gui.border_offset * 2;
|
| The " + gui.border_offset * 2" looks suspicious to me...
Sorry for misleading, that's the late hours of course ;)
gui.c have nothing to do with terminal i guess...

Bram Moolenaar
2004-07-20 19:19:58 UTC
Permalink
Post by Yakov Lerner
I think this is bug in vim. This can be observed in terminal emulator
which does not resize window width when you 'set columns=N'
to a lower value. One such terminal terminal emulator is gnome-terminal.
If you don't have gnome-terminal, you can also observe it in xterm if
you set TERM to vt100 ( TERM=vt100 will cause vim not to resize xterm's
window).
I noticed this in real editing when using multi-tabbed gnome-terminal. The
gnome-terminal had with of 200 columns but I wanted to watch for my long
lines and I set 'set solumns=80', and I noticed this thing.
You are supposed to set 'columns' to the actual width of the terminal.
Using a different value is not really supported. You might expect it
works, since it often does work. But not always...
Post by Yakov Lerner
7. You'll notice that the last character in long wrapped lines
is "ghost" character, replicated and drawn past 40-th column.
What happens here is that Vim outputs an extra character after the last
character in the line. This tells the terminal emulator that the line
wraps. When you now copy the text the terminal emulator won't insert a
line break here. This only works properly when 'columns' is set
correctly, of course.

To disable this trick reset the 'ttyfast' option. You probably won't
notice a disadvantage in a terminal emulator.
--
hundred-and-one symptoms of being an internet addict:
31. You code your homework in HTML and give your instructor the URL.

/// Bram Moolenaar -- ***@Moolenaar.net -- http://www.Moolenaar.net \\\
/// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
\\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
Loading...