0

Vim issue, note this happens only when i open gnu screen, on ubuntu, when shelled from a Mac, and only in the top pane of the screen (bottom pane works fine). It does not happen on the mac when i open screen. It is not a screen within a screen. I did install libncurses5.

symptom: Let's use my vertical split screen as an example, its 22 vim lines high currently. So when i open the file, and get the cursor on to line 1, then i scroll down to line 22, all is normal, then when i continue to scroll down only the last line changes (line 1-21 never changes, but where line 22 was, it correctly becomes line 23). This will continue until i get to line 37(e.g. i see 1-21, and 37 only), then when i scroll down once more to line 38 and stop, what i see is line 2-21(because the lines moved up by one finally), but then what i see is now line 2-21,37, and 45 now becomes visible. scrolling down once more i see 3-37,45,46, this pattern repeats until i get to bottom of the file.

Essentially I have to scroll down 36 times to make it say 37,45-65, if i scroll down once more, the page looks correct finally, showing a linear 45-66.

If i press 1g (go to line 1), i see 2-21,36,44 again. scrolling up doesn't replace line 2 with 1, but scrolling down by one now shows 1,2,4-21,36,44.

Essentially theres a 15 line buffer in there.

This only happens on gnu screen.

What i have done:

  • switching TERM=xterm-256color, ansi, screen-256color, doesnt help.
  • renaming .vimrc to bak.vimrc, still happens without .vimrc.

@roaima Thank you for comment. I see it is 48. What would I change at this point? There is only room for 22 Vim lines in this pane. Which one is incorrect, a Vim setting, or a terminal setting?

$ stty -a
speed 38400 baud; rows 48; columns 190; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O;
min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc

$ echo $LINES
48```

I suspect the whole screen is 48 high, but there is a split pane in the middle.  For the bottom pane vim shows 18 lines (And works correctly also) 

Edit: I do notice that in a correct setup, e.g. when i run my screen layout on the mac, `stty -a` correctly reports `23` rows in screen, and `49` without screen running.  So it seems the lines arent being updated by screen on the ubuntu. 

How would I go about manually setting that in .vimrc, or .screen, or somewhere that it will take affect when I open screen?
1
  • 1
    The idea of the number of lines in the terminal (37) differs from reality (22). Run stty -a and echo $LINES to identify the cause Apr 1, 2022 at 22:01

1 Answer 1

1

The idea of the number of lines in the terminal (37) differs from reality (22). By running stty -a and echo $LINES it should be possible to identify the cause.

To fix the wrong number of lines, setting it to 22:

stty rows 22

And if echo $LINES then still reports the wrong number,

export LINES=22

As an alternative to both, you may be able to force the terminal driver to identify the lines correctly; if this works then both stty -a and echo $LINES will report the newly corrected value:

kill -WINCH $$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .