bugGNU nano - Bugs: bug #48852, when the terminal is narrow, the...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #48852: when the terminal is narrow, the cursor is placed wrongly in the prompt bar

Submitter:  Benno Schulenberg <bens>
Submitted:  Mon 22 Aug 2016 09:54:04 AM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Jump to the original submission

Sat 28 Nov 2020 02:53:22 PM UTC, comment #8: 

The workaround was removed two days ago in commit 39705c60 as 1) for the most part it was only reproducible by setting COLS to a value that did not match the width of the terminal, and 2) I cannot reproduce it any more on Xubuntu 18.04 (libvte 0.52), so... people that are still stuck with an older libvte can stay with nano-5.3 (or earlier) or upgrade their whole system.

Benno Schulenberg <bens>
Group administrator
Thu 25 Aug 2016 09:09:32 AM UTC, comment #7: 

The problem has been reported upstream (https://lists.gnu.org/archive/html/bug-ncurses/2016-08/msg00021.html) and it appears to be partly a bug in VTE, and partly an optimization in ncurses (which goes wrong when COLS does not match the real right margin of the terminal).

A workaround for these was added in git, c22cd03.

Benno Schulenberg <bens>
Group administrator
Wed 24 Aug 2016 09:48:00 AM UTC, comment #6: 

When in src/global.c you change N_("Prepend") to N_("Prep"), and run 'stty cols 27 && LANGUAGE=en src/nano --ignore NEWS && stty cols 120' and type ^O, the cursor is placed correctly.  When you add back an "e" to make it N_("Prepe"), the cursor is placed wrongly.

So the trigger is: writing the very last character of the bottomwin subwindow.  But... not always.  Because if you run 'stty cols 27 && LANGUAGE=en src/nano --ignore --nohelp --bold NEWS && stty cols 120', the cursor is placed fine (but blank_statusbar() still writes the very last char of the subwindow; so how come?).  When you leave out the --bold, the cursor is placed wrong.  Pah.

Benno Schulenberg <bens>
Group administrator
Mon 22 Aug 2016 08:15:39 PM UTC, comment #5: 

Ugh.  It can't be fixed.  Apply the attached patch, which fixes the --ignorercfiles case.  But now run 'stty cols 27 && LANGUAGE=en src/nano --ignore --nohelp NEWS', and see how the cursor is still placed wrong.  Press <Left> four times -- upon the third <Left>, the cursor jumps two places.  The cursor never lands on the W.  When you put it on the S (meaning it is in fact on the W) and type xx, the exes get inserted before the W.  Bleh!  What the smurf is going on?

(file #38321)

Benno Schulenberg <bens>
Group administrator
Mon 22 Aug 2016 06:09:22 PM UTC, comment #4: 

The bug is in ncurses.  To prove it, apply the attached patch, run 'stty cols 27 && LANGUAGE=en src/nano NEWS', press ^O, wait for the beep, press <Left> at least four times, then press ^G ^G.  Both before and after the ^Gs, the cursor is placed wrongly: on the E of NEWS.

Now comment out the first of added doupdate()s, compile, and run the same command and do the same keystrokes again.  After the ^Gs, the cursor is now placed correctly: on the N of NEWS.  We update less, and the cursor is placed better...  Somehow ncurses does not work right on these terminal emulators.

It is time again for a forced line redraw.  :(

(file #38317)

Benno Schulenberg <bens>
Group administrator
Mon 22 Aug 2016 01:39:39 PM UTC, comment #3: 

On a Linux console, the cursor is placed always correctly.  On a VTE or an xterm, if the cursor is placed wrong and you do a <Left> followed by a ^G ^G, the cursor will be placed correctly -- and will stay placed correctly as long as you don't do a ^G ^G again while the cursor is in the last two possible columns.

Doing 'stty cols 27 && LANGUAGE=en src/nano NEWS', the cursor will be placed one position beyond its true position.  Using instead "cols 28", it will be placed fine.  Totally bonkers!

Benno Schulenberg <bens>
Group administrator
Mon 22 Aug 2016 11:41:44 AM UTC, comment #2: 

Run 'stty cols 12 && src/nano --ignore --nohelp NEWS', then type ^O <Left> <Left> <Left> <Left>.  The statusbar ends with ":$ N", which is wrong.  Now press ^G ^G.  Now the statusbar ends with ": N ", which is better -- but the cursor is placed not on the N but after it, and the space after the N should be a $.

Now press <Right>.  Result ": $E".  Press ^G ^G.  Result: ":$E ".  Hrrrmm...  Why does the position change by a simple repainting?

Benno Schulenberg <bens>
Group administrator
Mon 22 Aug 2016 10:09:27 AM UTC, comment #1: 

Hrm.  When using '--ignore --nohelp --bold', the cursor is placed correctly.  When leaving out the --bold, the cursor is placed wrong.  Also when in the .nanorc file a titlecolor is given, the cursor is placed correctly with --nohelp.  Maybe I'm looking at a bug in ncurses here.

Benno Schulenberg <bens>
Group administrator
Mon 22 Aug 2016 09:54:04 AM UTC, original submission:  

To reproduce, do 'stty cols 12 && src/nano --ignore NEWS' and type ^O.  The prompt bar will show: "File Nam:$ C" (where C is the cursor).  When you press <Left> a few times, it will show each of the letters of "NEWS" at the very end of the prompt bar, instead of right after the $.  When you then press <Right>, it will show an extra $: "File Nam:$$C".  Which is wrong.

Before version 2.3.3 it would correctly show: "File Nam:$C ".

The offending commit is 8977c4b.  Which is weird!  It shouldn't affect the prompt bar at all.  Aaah...  But it doesn't.  When using --nohelp, the cursor is always placed wrongly on a narrow terminal, since at least version 2.2.1.

Benno Schulenberg <bens>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-09-02 bens Open/ClosedOpen Closed
    2016-08-25 bens StatusConfirmed Fixed
    2016-08-24 bens StatusIn Progress Confirmed
    2016-08-22 bens Attached File- Added 0001-statusbar-place-the-cursor-correctly-also-when-near-.patch, #38321
    2016-08-22 bens Attached File- Added proving-the-point.patch, #38317
        StatusNone In Progress

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code