0

I run centos linux 7

Kernel 3.10.0-957

Graphics are nvidia, resolution 2560,1440

echo $TERM returns linux

In all of my ctrl+alt+f# virtual consoles, the text scrolls past the bottom of the display. This is difficult to describe, but it seems as if the monitor is showing only the top part of the display.

My prompt starts at the top of my monitor. Then I hit enter and get a new prompt right below that one (no surprises so far!). However, if I keep doing this, when the prompt reaches the bottom of the display, it does not scroll. Similar behavior if I cat some long file ... the prompt disappears below the display. I recover my prompt by typing 'clear' or 'reset'.

Note that vim works properly ... its : prompt appears at the bottom of the display as it should.

I have followed some tutorials on setting GRUB_GFXMODE to adjust the console resolution, but this had no effect.

Please help me correct this problem with my virtual consoles.

2
  • I'm not an expert on terminals but it might be worth editing your question to include the results of echo $LINES (run from Bash shell) and :echo &lines (run from Vim) to see what each program thinks is the length of the terminal. BTW, the ones you're asking about (available via Ctrl+Alt+F) are referred to as virtual consoles. Commented Jul 12, 2019 at 16:46
  • echo $LINES returns 25. vim :echo &lines returns 25. I counted the lines by hand, and there are indeed 25. Commented Jul 15, 2019 at 16:39

1 Answer 1

0

bash's use of $LINES does not matter (much). What does matter is the screensize which you can see with stty, e.g.,

$ stty -a
speed 38400 baud; rows 40; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = ;
eol2 = ; swtch = ; 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

bash uses that information rather than $LINES and $COLUMNS.

For instance, you may have a script which did something like

$ stty rows 99
$ stty -a
speed 38400 baud; rows 99; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = ;
eol2 = ; swtch = ; 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

If bash is confused about the screensize (either rows or columns), its line-editing does not work very well.

You must log in to answer this question.

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