xterm geometry and vim display glitches

156 views
Skip to first unread message

Paul

unread,
Apr 18, 2010, 3:37:06 PM4/18/10
to vim_use
I am running Vim 7.2 within gnome-terminal, term=xterm, and I just
noticed a strange glitchiness: hitting Escape produces the string
^[ at the bottom of the screen, wrapped around to two lines (instead
of in the statusbar), and the arrow keys produce A B C D. As these
characters are added at the bottom, the usable area of the window
quickly scrolls off the top and the Vim session becomes unusable. I
put a screenshot here: http://imgur.com/A0Oei.png

It's not a problem for me. I thought I'd point it out here though
because there's an odd quirk: it only happens when the gnome-terminal
window is set to exactly 100 characters wide when Vim is launched.
With it at 99, 101, 200, Vim is fine. Vim is also fine if I launch it
first and then resize the window to 100.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Subscription settings: http://groups.google.com/group/vim_use/subscribe?hl=en

John Little

unread,
Apr 18, 2010, 8:39:58 PM4/18/10
to vim_use
On Apr 19, 7:37 am, Paul <paulwi...@gmail.com> wrote:
> I am running Vim 7.2 within gnome-terminal, term=xterm, and I just
> noticed a strange glitchiness....

I can't reproduce this. Sounds like vim's idea of the window size is
out of sync with the actual size, and you've got showcmd set.
Your png shows the splash text shifted to the right somewhat, as if
vim thinks the window is wider than it is; the "t" of type appears to
be in column 32, but when I run vim in a 100 column gnome-terminal,
the "t" is in column 28.

I speculate that the reason you only notice a problem with exactly 100
columns is that the showcmd display has two characters, and you get
the screen disturbance when the first of the two hits column 100. If
I'm right, you'd get quite a mess if you edit a file that has lines
longer than about 100 columns, with the window size not exactly 100
columns.

Does it happen with vim -u NONE? What does
:set columns
say?

Does it happen if you change the font in gnome-terminal?

Regards, John

bill lam

unread,
Apr 18, 2010, 10:02:55 PM4/18/10
to vim_use
dim, 18 Apr 2010, Paul skribis:
> I am running Vim 7.2 within gnome-terminal, term=xterm, and I just
> noticed a strange glitchiness: hitting Escape produces the string
> ^[ at the bottom of the screen, wrapped around to two lines (instead
> of in the statusbar), and the arrow keys produce A B C D. As these
> characters are added at the bottom, the usable area of the window
> quickly scrolls off the top and the Vim session becomes unusable. I
> put a screenshot here: http://imgur.com/A0Oei.png
>
> It's not a problem for me. I thought I'd point it out here though
> because there's an odd quirk: it only happens when the gnome-terminal
> window is set to exactly 100 characters wide when Vim is launched.
> With it at 99, 101, 200, Vim is fine. Vim is also fine if I launch it
> first and then resize the window to 100.

I encountered similar issue. I guess for console vim, the variable
'columns' (and also 'lines') is only meant for reporting rather than
setting because vim itself cannot change the geometry of the terminal
emulator. Moreover, even the terminal emulator or gvim cannot change
its geometry at will because that is to be controlled by window
manager. Consequently I did not set those variables inside vimrc
again.

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3

Paul

unread,
Apr 19, 2010, 12:31:16 AM4/19/10
to vim_use
On Apr 18, 8:39 pm, John Little <john.b.lit...@gmail.com> wrote:

> Does it happen with vim -u NONE?

Yes.

> What does
>     :set columns
> say?

columns=100

> Does it happen if you change the font in gnome-terminal?

Yes.

John Little

unread,
Apr 19, 2010, 6:50:37 AM4/19/10
to vim_use

On Apr 19, 2:02 pm, bill lam wrote:
> I encountered similar issue.  I guess for console vim, the variable
> 'columns' (and also 'lines') is only meant for reporting rather than
> setting because vim itself cannot change the geometry of the terminal
> emulator.

Er, no. For me, if I start gnome-terminal with 80 columns, run vim
and type :set columns=100, the gnome-terminal window is resized, and
on exiting vim persists with 100 columns, and COLUMNS=100 in the
environment. SIGWINCH signals fly about to tell processes about
window size changes, I wonder if the OP has this disabled or trapped,
confusing things.

regards, John

bill lam

unread,
Apr 19, 2010, 10:05:44 AM4/19/10
to vim_use
lun, 19 Apr 2010, John Little skribis:
>
> On Apr 19, 2:02 pm, bill lam wrote:
> > I encountered similar issue.  I guess for console vim, the variable
> > 'columns' (and also 'lines') is only meant for reporting rather than
> > setting because vim itself cannot change the geometry of the terminal
> > emulator.
>
> Er, no. For me, if I start gnome-terminal with 80 columns, run vim
> and type :set columns=100, the gnome-terminal window is resized, and
> on exiting vim persists with 100 columns, and COLUMNS=100 in the
> environment. SIGWINCH signals fly about to tell processes about
> window size changes, I wonder if the OP has this disabled or trapped,
> confusing things.

I think that client can request window manager to change size but it
is always up to window manager to determine the final result. I
suspect that vim did not verify the actual geometry after set columns.
I've never browse the relevant vim source code thus this is just a
wild guess.

I use dwm which is a tilt window manager, when I start vim it reports
columns=113, I can :set columns=200 it completed without complaining
and :set column? gave 200, but the actual console size cannot and was
never changed. The status bar then spread into 2 lines.

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3

anatoly techtonik

unread,
Apr 19, 2010, 4:34:23 PM4/19/10
to vim_use
Can this be related to so-called 'compatible' mode?
https://bugs.edge.launchpad.net/ubuntu/+source/vim/+bug/491615

Paul

unread,
Apr 20, 2010, 7:42:57 PM4/20/10
to vim_use
On Apr 19, 6:50 am, John Little <john.b.lit...@gmail.com> wrote:

> For me, if I start gnome-terminal with 80 columns, run vim
> and type :set columns=100, the gnome-terminal window is resized, and
> on exiting vim persists with 100 columns, and COLUMNS=100 in the
> environment.  SIGWINCH signals fly about to tell processes about
> window size changes, I wonder if the OP has this disabled or trapped,
> confusing things.

Apparently yes. :set columns=50 does not resize the terminal window.
Don't know what is trapping this in vanilla Ubuntu. It's not just
gnome-terminal; I can't resize any terminal window from within vim,
nor with "export COLUMNS=50" on the command line. But gvim resizes
just fine.

bill lam

unread,
Apr 20, 2010, 9:48:40 PM4/20/10
to vim_use
lun, 19 Apr 2010, anatoly techtonik skribis:
> Can this be related to so-called 'compatible' mode?
> https://bugs.edge.launchpad.net/ubuntu/+source/vim/+bug/491615
>

Don't know. My main point was that vim apparently ignore the fact
that 'set columns' can actually fail.

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3

Matt Wozniski

unread,
Apr 21, 2010, 10:36:08 PM4/21/10
to vim...@googlegroups.com
On Tue, Apr 20, 2010 at 9:48 PM, bill lam wrote:
> lun, 19 Apr 2010, anatoly techtonik skribis:
>> Can this be related to so-called 'compatible' mode?
>> https://bugs.edge.launchpad.net/ubuntu/+source/vim/+bug/491615
>>
>
> Don't know.  My main point was that vim apparently ignore the fact
> that 'set columns' can actually fail.

It doesn't *ignore* that fact, it just can't possibly catch and handle
the case where the terminal doesn't support it. Vim can't ask the
terminal what size it is, so if the terminal decides not to resize
itself, vim can't know any better.

~Matt

bill lam

unread,
Apr 21, 2010, 11:04:38 PM4/21/10
to vim...@googlegroups.com
mer, 21 Apr 2010, Matt Wozniski skribis:
> On Tue, Apr 20, 2010 at 9:48 PM, bill lam wrote:
> > lun, 19 Apr 2010, anatoly techtonik skribis:
> >> Can this be related to so-called 'compatible' mode?
> >> https://bugs.edge.launchpad.net/ubuntu/+source/vim/+bug/491615
> >>
> >
> > Don't know.  My main point was that vim apparently ignore the fact
> > that 'set columns' can actually fail.
>
> It doesn't *ignore* that fact, it just can't possibly catch and handle
> the case where the terminal doesn't support it. Vim can't ask the
> terminal what size it is, so if the terminal decides not to resize
> itself, vim can't know any better.
>

I don't understand why vim can learn the size of terminal at startup,
but can't after 'set columns'.

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3

Reply all
Reply to author
Forward
0 new messages