bugGNU nano - Bugs: bug #47716, a lone final \r of a Mac file is...

 
 

bug #47716: a lone final \r of a Mac file is not read in

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Sat 16 Apr 2016 02:44:49 PM UTC  
 
Severity: 3 - NormalStatus: Fixed
Assigned to: Benno Schulenberg <bens>Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Sun 17 Apr 2016 11:28:15 AM UTC, comment #1:

Fixed in git, 086b852.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sat 16 Apr 2016 02:44:49 PM UTC, original submission:

To reproduce, run 'src/nano --ignore --nonewline +8 somefile', where somefile is a new file. Type: 1 <Enter> 2 <Enter> <Enter> <Enter> <Enter>. Then type ^O <Enter> and notice that it said "Wrote 5 lines". Now exit and run the same command again. Notice that it says "Read 5 lines". Good. Now type ^O M-M <Enter>. It says it wrote 5 lines. Exit and run the same command again. It says it read 5 lines, but notice that the cursor is now a line further up. Now repeat: ^O <Enter> ^X, and rerun the same command. Notice how every time a line less is written, and the cursor creeps up until it sits on the 2. And there it stays. The file now has just two lines.

There is a piece of code that seems intended to handle such a lone \r (in src/files.c where it says "as a Mac format line"), but it never triggers. I don't get it. The fragment after it triggers, but somehow this does not result in an extra line.

When you do the same procedure (save, exit, reopen) with a DOS of Unix file, it stays five lines -- as one would expect.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to 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):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 20 Jun 2016 09:58:42 AM UTCbensOpen/ClosedOpen=>Closed
    Sun 17 Apr 2016 11:28:15 AM UTCbensStatusIn Progress=>Fixed
      Summarya lone final \\r of a Mac file is not read in=>a lone final \r of a Mac file is not read in
    Sat 16 Apr 2016 03:41:46 PM UTCbensStatusNone=>In Progress
      Assigned toNone=>bens
      Summarya lone final \\r of a Mac file is not read in=>a lone final \r of a Mac file is not read in

    Back to the top


    Powered by Savane 3.1-cleanup1