bugGNU nano - Bugs: bug #51427, some characters at the start of a...

 
 

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

bug #51427: some characters at the start of a row sometimes disappear

Submitter:  Benno Schulenberg <bens>
Submitted:  Sun 09 Jul 2017 07:03:30 PM UTC
   
 
Severity:  4 - Important Status:  Fixed
Assigned to:  dolorous Open/Closed:  Closed

Mon 10 Jul 2017 07:41:43 AM UTC, comment #3: 

Thanks!  Patch has been pushed to master, 4f3249de.

(The bug existed since nano-2.8.0.)

(What puzzled me was why a ^L fixed the issue, because the situation was still exactly the same.  But of course: the second <Delete> redraws only the current line, while a ^L redraws all the lines, in order.  If nano would paint the lines in reverse order, the issue would remain even after a ^L.)

Benno Schulenberg <bens>
Group administrator
Sun 09 Jul 2017 08:50:58 PM UTC, comment #2: 

I've looked into this, and the problem is in display_string().

When display_string() cuts off a converted string for being wider than the screen, it moves back one character before doing so.  However, if the last character of the converted string is a tab, it consists of tabsize characters (tabsize spaces, or one whitespace display character and [tabsize - 1] spaces).  So moving back one character isn't enough; the leftover characters of the tab still get displayed, and they spill over onto the next screen row.

The attached patch should fix it.  It breaks off adding the spaces from a tab as soon as doing so overshoots the screen width, so moving back one character will keep the resulting converted string within one screen row.

(file #41154)

David Lawrence Ramsey <dolorous>
Group Member
Sun 09 Jul 2017 07:58:15 PM UTC, comment #1: 

To reproduce, make it so that your terminal is actually 74 columns wide (the number of rows doesn't matter much, 25 is fine).  Then run:

  src/nano --ignore --nowrap  +225,49  src/nano.h

Then type <Enter> and at least six times <Tab>.  Then press <Up> and slowly press <Delete> twice.  The first <Delete> removes the newline that was newly inserted, and the second <Delete> removes the first of the tabs.  But watch what happened on the next row: the "#endi" part of "#endif" disappeared!

Now press ^L.  The "#endi" part is restored.

Do the same procedure again, but now press Alt+P before starting to type anything.

Apparently in some cases, when a tab doesn't entirely fit on a row, the remainder of its spaces are spilled onto the next row.

(When using a default terminal size of 80 columns and a default tab size of 8, one will never see this problem.  But when the terminal width is not a precise multiple of the tab size, and there are overlong lines which have tabs in them, then one might see it.)

Benno Schulenberg <bens>
Group administrator
Sun 09 Jul 2017 07:03:30 PM UTC, original submission:  


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 dolorous (Updated the item)
  • -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
    2017-07-22 bens Open/ClosedOpen Closed
    2017-07-10 bens StatusNone Fixed
        Assigned toNone dolorous
    2017-07-09 dolorous Attached File- Added 0001-display-when-displaying-tabs-don-t-go-beyond-the-scr.patch, #41154
    2017-07-09 bens Severity3 - Normal 4 - Important
        Summarysome characters sometimes disappear on an Xfce4 Termnal some characters at the start of a row sometimes disappear

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code