bugGNU nano - Bugs: bug #59982, pasting a large piece with triple...

 
 

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

bug #59982: pasting a large piece with triple quotes can cause miscoloring

Submitter:  Benno Schulenberg <bens>
Submitted:  Sun 31 Jan 2021 03:54:50 PM UTC
   
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Wed 03 Feb 2021 04:06:35 PM UTC, comment #1: 

Fixed in git, commit 1fdd23d3, by forcibly recalculating the multidata when a paste or insertion is larger than the screen.

Recalculating the multidata also in other circumstances (to avoid the cost of backtracking AND to speed up just navigating the file) is left as a possibility for later.

Benno Schulenberg <bens>
Group administrator
Sun 31 Jan 2021 03:54:50 PM UTC, original submission:  

To reproduce, run:

src/nano --syntax=syntax/python -Ypython +15 README

Then type: ''' ^Up ''' ^Up
See that the paragraph from "First and foremost" to "Yuck" is colored green.

Now type: M-A ^V ^N ^N ^N M-6 M-\ ^U
See that after the paste, all the text /before/ "First and foremost" is green.

Now type: ^Y ^V
See that now the text is colored as it should be.

The problem is of course that in Python the start= and end= regexes for doc strings can match on the same thing, and when backtracking from somewhere in the middle of the file, nano cannot know whether a found start match isn't really an end match (when beginning the scanning at the start of the file).

So the question becomes: should nano recalculate the multidata whenever a paste is larger than the screen (or rather: whenever part of a paste goes offscreen)?

Maybe nano should recalculate the multidata always when a significant change is made?  The recalculation takes quite some time, but it has the advantage that then painting the screen becomes real quick: never any backtracking is needed, and only for lines that are marked other than NOTHING, WOULDBE and WHOLELINE would nano need to do regex matching on the line (for the multiline regexes).  Scrolling, paging up and down, and any other navigating the file will be fast.  Maybe this would be worth it?

Benno Schulenberg <bens>
Group administrator

 

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

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

    Date Changed by Updated Field Previous Value => Replaced by
    2021-02-25 bens Open/ClosedOpen Closed
    2021-02-03 bens StatusNone Fixed
        Assigned toNone bens

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code