bugGNU nano - Bugs: bug #57404, justification falters when tabs...

 
 

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

bug #57404: justification falters when tabs and spaces are mixed

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Fri 13 Dec 2019 11:24:40 AM UTC
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Tue 24 Dec 2019 09:13:58 AM UTC, comment #5: 

Released in 4.7.

Benno Schulenberg <bens>
Project Administrator
Tue 17 Dec 2019 04:11:05 PM UTC, comment #4: 

Refixed in git, commit b00c1d61.  Now a ^J in the original recipe rewraps all four lines into a single paragraph, because it considers any mix of tabs and spaces that results in the same displacement of the succeeding text as effectively the same.

Benno Schulenberg <bens>
Project Administrator
Tue 17 Dec 2019 03:00:05 PM UTC, comment #3: 

On second thought: the fix is wrong.  Take, for example, the following piece of text, where the first line is indented with one tab and all the subsequent lines with two spaces each:

        First words
  more and more words
  more and more words
  more and more words.

This is obviously a single paragraph and should be treated as such.  Versions 2.9.8 to 4.6 did this.  But nano from current git sees the second line as the start of a new paragraph, because its leading space differs from the leading tab of the preceding line.  Bad.  (Nano 2.9.7 and earlier behaved the same as current git for this case.)

So... instead of trying to go back to the pre-2.9.8 behavior, let's treat identical-*looking* indentation as the same.

Benno Schulenberg <bens>
Project Administrator
Tue 17 Dec 2019 11:33:29 AM UTC, comment #2: 

Fixed in git, commit 594ef222.  It restores the pre-2.9.8 behavior: lines indented with spaces are not merged with lines that are indented with tabs.

But still remains the question: maybe nano should consider lines that have the same indentation width as having equal indentation?  No matter whether the indentation consists of tabs or spaces or a mix of them?  I think that would be the "humanly-correct" thing to do.

Benno Schulenberg <bens>
Project Administrator
Fri 13 Dec 2019 01:19:57 PM UTC, comment #1: 

Proposed patch is attached.

(file #48049)

Benno Schulenberg <bens>
Project Administrator
Fri 13 Dec 2019 11:24:40 AM UTC, original submission:  

To reproduce, first create a file 'mixed' with the following content:

        well well
        well well
        word word
        word word

where each of the first two lines are indented with eight spaces, and each of the latter two lines with a single tab.  Then run 'nano --ignore mixed' and type ^J.  See how only the four "well"s are rewrapped into a single line.  This is unexpected, because visually the whole text looks like a single paragraph.  Now type ^J again.  Ho!  Now the four "word"s are rewrapped together with the "well"s into a single line!  This is wrong.

Expected behavior: either the first ^J should have rewrapped the whole text into a single line, or the second ^J should have rewrapped only the four "word"s into a single line, keeping it a separate paragraph.

Bug exists since version 2.9.8.  Version 2.9.7 and earlier would keep the "well"s and the "word"s as separate paragraphs.

Benno Schulenberg <bens>
Project Administrator

 

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

Attach Files:
   
   
Comment:
   

 

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.

    Only logged-in users can vote.

     

     

     

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-12-24 bens Open/ClosedOpen => Closed
    2019-12-17 bens StatusIn Progress => Fixed
    2019-12-17 bens StatusFixed => In Progress
    2019-12-17 bens StatusIn Progress => Fixed
    2019-12-13 bens Attached File- => Added 0001-justify-distinguish-between-tabs-and-spaces-when-com.patch, #48049
        StatusNone => In Progress
        Assigned toNone => bens

    Back to the top


    Powered by Savane 3.9