bugGNU nano - Bugs: bug #58481, text can be colored incorrectly...

 
 

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

bug #58481: text can be colored incorrectly after a replacement

Submitter:  Benno Schulenberg <bens>
Submitted:  Tue 02 Jun 2020 07:41:07 AM UTC
   
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Tue 02 Jun 2020 05:27:32 PM UTC, comment #3: 

The fix was made more economical in the subsequent commit, e81e18dd.

Benno Schulenberg <bens>
Group administrator
Tue 02 Jun 2020 04:54:41 PM UTC, comment #2: 

Fixed in git, commit 569d0056.

The fix is somewhat wasteful, because the multiline color info may get recalculated for every replacement also when the user chooses "All".  This can be improved.

Benno Schulenberg <bens>
Group administrator
Tue 02 Jun 2020 04:50:59 PM UTC, comment #1: 

The recipe of course depends on the size of the terminal.  To see the miscolored text, the terminal has to have fewer than 40 rows (or still fewer when using --nohelp).

Benno Schulenberg <bens>
Group administrator
Tue 02 Jun 2020 07:41:07 AM UTC, original submission:  

To reproduce, first add this line to your ~/.nanorc:

extendsyntax default color brightred start="for" end="bugs"

Then run: 'src/nano +1 README'.
Type: M-R for <Enter> xxx <Enter>
Then type five times: Y

For the sixth prompt, the viewport jumps to the last third of the file.  But see that the text before the "for" is still colored red.  This should not be possible, because there is no word "for" anymore before the spotlighted "for".

Type: ^C M-W.  The text is still colored wrong.
Type: ^Y ^V.  Ah.  Now the text is colored correctly.

The problem is that when the screen is redrawn after the fifth replacement, none of the lines that will be onscreen for the prompt about the sixth replacement will get redrawn, so none of those lines will get their multiline color info recalculated.  So when the screen is drawn for the sixth prompt, it will use old multiline data and will thus paint all lines red that still have CWHOLELINE set.  :|  (There was some logic behind Chris' resetting the multiline info when a line was changed.)

The only way to solve this that I see, is to call check_the_multis() after a replacement, and if it says it needs a refresh, then do a full precalc_multicolorinfo().

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

    Date Changed by Updated Field Previous Value => Replaced by
    2020-07-30 bens Open/ClosedOpen Closed
    2020-06-02 bens StatusIn Progress Fixed
    2020-06-02 bens StatusNone In Progress
        Assigned toNone bens

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code