nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] the cursor getting placed outside the terminal


From: Benno Schulenberg
Subject: [Nano-devel] the cursor getting placed outside the terminal
Date: Wed, 28 Jun 2017 11:13:17 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1


Op 27-06-17 om 18:17 schreef David Ramsey:
1. Start with the varisoft branch of nano, with the above patch applied.

2. Copy the attached file nanorc.txt to your .nanorc.

3. With the attached file 50colbug.txt, run:

./nano --ignore --softwrap 50colbug.txt

It seems you missed setting the terminal to fifty columns?

4. Press End.  The cursor is placed where you'd expect: the next-to-last
column of the screen row.

No, it is placed in the very last column of the row, for me.

5. Now run:

./nano 50colbug.txt

so that the nanorc is loaded.

6. Press End.  The cursor is now placed one column past where you'd
expect: the last column of the screen row,

No, it is placed just beyond the last column of the row.  This is an
artifact of using 'stty cols'.  When using a terminal that is actually
fifty columns wide, it works fine -- for me -- both on xterm and on a
VTE-based one.

Running step 5, but toggling --constupdate mode off via Meta-C before
running step 6 will fix the problem.  Also, running step 5, but toggling
--nohelp mode off via Meta-X before running step 6 will fix the problem.
I'm guessing that there's a screen update missing somewhere, or there
may be something wrong with cursor placement with both of those options
set.

The cause is that when the position is displayed on the bottom row of
the screen, it doesn't fit, and the actual cursor remains "stuck" in
column 51 of the bottom row.  But ncurses thinks that the cursor cannot
go offscreen, so it thinks it must be in column 50.  So when the cursor
is moved to row 2, column 50, ncurses just sends a bunch of cursor-up
commands and thinks it has put the cursor in the right place.

We could add a similar workaround as in commit 0a18d891, but since the
problem does not happen when the terminal is actually fifty columns wide,
I don't think it's needed.  (And maybe the above workaround could go too,
as the problem it fixes is also just an artifact of 'stty cols' -- it no
longer happens on modern VTEs that actually have the advertised size.)

Benno



reply via email to

[Prev in Thread] Current Thread [Next in Thread]