bugGNU nano - Bugs: bug #53986, when the indentation is bigger...

 
 

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

bug #53986: when the indentation is bigger than the fill width, nano fails to wrap

Submitter:  Benno Schulenberg <bens>
Submitted:  Sat 26 May 2018 06:47:32 PM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Thu 19 Dec 2019 03:27:50 PM UTC, comment #3: 

(A year and a half later the corresponding bug for automatic hard-wrapping got fixed too: bug #57425.)

Benno Schulenberg <bens>
Group administrator
Sun 27 May 2018 08:31:28 AM UTC, comment #2: 

Oof -- I did a cast only on the second comparison (column <= goal).  When doing the cast on both comparisons, things work as expected, without making goal zero.

The better change has been pushed to master, commit a832f332.

Benno Schulenberg <bens>
Group administrator
Sat 26 May 2018 07:05:02 PM UTC, comment #1: 

When using -r13, nano will rewrap the NEWS file like Pico does.  Which is strange, because those indented lines don't fit within 13 columns either.

The problem is that the comparison of size_t (column) with ssize_t (goal) goes wrong somehow: when goal is negative and column is some positive number, then the comparison (column <= goal) evaluates to true.  :|

But correcting that with a cast makes it even worse: only the last word of the paragraph is wrapped.  :(

Attached patch (making sure that goal is never negative) seems to fix the problem.

(file #44221)

Benno Schulenberg <bens>
Group administrator
Sat 26 May 2018 06:47:32 PM UTC, original submission:  

First have a look at what Pico does:

  pico -r11 NEWS

and type ^J twice.  Note how it rewraps the first line to fit within the requested 11 columns.  The indented lines, however, do not fit within 11 columns (the indentation is 13 spaces), so pico falls back to wrapping each line at the earliest possible blank that isn't part of the indentation.  Fair enough.

Now see what nano does:

  nano --ignore --auto -r11 NEWS

and type ^J twice.  The first line is rewrapped in the same way as pico does.  But the indented lines... they are concatenated to a single, long, unwrapped line.  Absurd.

The bug is old -- since at least version 2.0.9.

Benno Schulenberg <bens>
Group administrator

 

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

Attached Files

 

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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-06-02 bens Open/ClosedOpen Closed
    2018-05-27 bens StatusIn Progress Fixed
    2018-05-26 bens Attached File- Added a-negative-goal-is-nonsense.patch, #44221
        StatusNone In Progress
        Assigned toNone bens

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code