bugGNU nano - Bugs: bug #52954, on a console, nano shows junk in...

 
 

bug #52954: on a console, nano shows junk in front of line numbers

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Mon 22 Jan 2018 08:31:24 PM UTC  
 
Severity:  3 - Normal Status:  None
Assigned to:  None Open/Closed:  Open

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 08 Feb 2018 07:19:09 PM UTC, comment #3:

Inserting a soft-hyphen between an a and a b causing the b to "disappear"... yes, that is a manifestation of the same problem: the terminal and ncurses disagree about the width of the displayed character.

(Sure, it happens also with files other than binary. It's just that binary files contain a wide range of possible and impossible characters, something one doesn't find in any normal text file present on the average computer. So, a binary file is a nice test.)

The problem is not limited to the soft hyphen. On the console, many characters cannot be displayed -- the font apparently does not contain any glyph for them -- so it gets replaced by a diamond, and this is problematic. Because when this happens for a zero-width character... the rest of the line gets displayed one column too far, and thus the junk problem ensues.

An example of a zero-width character that becomes a diamond on my Linux console: U+06E2.

Benno Schulenberg <bens>
Project Administrator
Tue 06 Feb 2018 05:25:02 PM UTC, comment #2:

Addendum: There are a few bits I forgot to mention:

In step 5, pressing Ctrl-L to refresh the screen will redisplay the "b", but the cursor will be shifted left and placed on a new blank character between "a" and "b". This behavior takes place on Xfce4-terminal (and KDE5 Konsole behaves the same way).

xterm behaves slightly differently: after step 4, there will be a "-" displayed where "b" was instead of a blank space (so "b" won't seem to disappear, but will seem to be replaced by a hyphen). urxvt also behaves differently: after step 4, "b" is still displayed at the same place, but a byphen is overlaid over the "a". So part of this seems to be terminal-dependent.

David Lawrence Ramsey <dolorous>
Project Administrator
Tue 06 Feb 2018 04:22:50 PM UTC, comment #1:

The problems that nano has displaying the Unicode soft hyphen aren't limited to just the console, line numbering mode, or binary files. With either nano 2.9.3 or current git (d865d7ac), try the following:

1. Assuming the binary is in the current directory, run:

./nano --ignore

2. In the new buffer, type:

ab

3. Press <Left> to move the cursor back on top of the "b".

4. Use verbatim input mode (Meta-V 0 0 0 0 A D) to insert a soft hyphen there. Note that the cursor will remain in the same place, while the "b" will seem to disappear.

5. Press Ctrl-L to refresh the screen. The "b" will be displayed again, this time one character to the right of the cursor.

If this is a different manifestation of the same problem, maybe the subject of this bug should be adjusted?

David Lawrence Ramsey <dolorous>
Project Administrator
Mon 22 Jan 2018 08:31:24 PM UTC, original submission:

To reproduce, switch to a Linux console (for example with Ctrl+Alt+F2) and then run:

nano --linenum nano-2.9.2.tar.xz

(yes, we're going to look at a binary file full of "random" junk).

Then type <PageDown> a few times, and see how in front of many line numbers some seemingly random character appear -- mostly a dollar sign ($), sometimes another character followed by a dollar sign.

When running the same command on a terminal emulator running on X, the same problem does not happen. At least, so it seems. But... press <PageDown> until line 280 is onscreen. See how there is dollar sign in front of line 281. Now move the cursor down to line 280, then press <Right> eight times, to put the cursor on the space between "2" and "jrks". Now press <Right> again. The cursor does not move -- apparently there is a zero-width character there. Press <Right> again -- note that "j" under the cursor gets 'copied' to the left. The same 'copying' happens for the next three <Right>s. Now press ^L -- the "jrks" gets moved one position to the right again.

Nano is confused about how wide this invisible, zero-width character is. After a ^L, it gets displayed as a space; but when you move the cursor over it, it disappears. Maybe there is a discrepancy between what mbwidth() says and how wide ncurses thinks the character is, or how the terminal shows it when it is fed that character?

The relevant character in this case is U+00AD (0xC2 0xAD), a soft hyphen.

Benno Schulenberg <bens>
Project Administrator

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No changes have been made to this item

    Back to the top


    Powered by Savane 3.1-cleanup1