bugGNU nano - Bugs: bug #50997, with softwrap, the replace...

 
 

bug #50997: with softwrap, the replace highlight can be drawn in the wrong place

Submitted by:  David Lawrence Ramsey <dolorous>
Submitted on:  Wed 10 May 2017 09:56:43 PM UTC  
 
Severity: 4 - ImportantStatus: 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.

 

Fri 12 May 2017 08:18:32 PM UTC, comment #4:

Pushed, 28beb3f9. Thanks for testing.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Fri 12 May 2017 07:49:09 PM UTC, comment #3:

Looks good to me, after some quick testing.

David Lawrence Ramsey <dolorous>
Project Administrator
Thu 11 May 2017 08:34:15 PM UTC, comment #2:

Attached patch fixes it for me.

(There is another mislighting when replacing a double-width character that straddles a row boundary: the last (now blank) column highlighted plus the double-width character is highlighted at the start of the next row, and the subseqent character "disappears" (is hidden until the replacement is done or skipped). But I will leave that as-is, because it can't really be fixed. It will be fixed when the variable-width stuff lands.)

(file #40668)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Thu 11 May 2017 07:47:29 PM UTC, comment #1:

Confirmed. In former times, the search/replace routines used to set placewewant, so then this would have worked. But they don't do that anymore, so placewewant does not correspond with [current, current_x] when place_the_cursor() is called in this case. It is in fact a misuse of place_the_cursor() -- it is not about putting the cursor at the point where extra characters will be inserted when the user starts typing, here it is just about translating [current, current_x] to a [row, col] coordinate on the screen and moving the cursor there in order to write the spotlighted word. In this case it also unnecessarily (and probably wrongly) changes current_y.

The two call of place_the_cursor() in cut.c and files.c are abuses too. They don't actually want to place the cursor (this can only be done when the screen has been redrawn), they just want to compute on which row the cursor now (after the insertion) virtually is.

These three uses of place_the_cursor() will have to be pulled apart somehow.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Wed 10 May 2017 09:56:43 PM UTC, original submission:

1. With current git and the attached file, run:

nano nanobug.txt

2. Immediately press ^W^R to get to the "Replace:" prompt.

3. Enter "softwrapped" as the word to be replaced, and enter "xxx" as the word to replace it with.

4. The word "softwrapped" will be displayed highlighted, but not where the word "softwrapped" actually is; it will instead be displayed at the beginning of the second row of the screen.

The bug seems to be caused by one of the workarounds used in softwrap mode with two-column characters on the edge of the screen, since reverting commit f3e2ad9 fixes it.

David Lawrence Ramsey <dolorous>
Project Administrator

 

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

Attach File(s):
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bens (Posted a comment)
  • -unavailable- added by dolorous (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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 19 May 2017 10:14:56 AM UTCbensOpen/ClosedOpen=>Closed
    Fri 12 May 2017 08:18:32 PM UTCbensStatusIn Progress=>Fixed
    Thu 11 May 2017 08:34:15 PM UTCbensAttached File-=>Added 0001-replacing-don-t-let-placewewant-influence-the-placem.patch, #40668
      StatusNone=>In Progress
    Thu 11 May 2017 07:47:29 PM UTCbensSeverity3 - Normal=>4 - Important
      Assigned toNone=>bens
    Wed 10 May 2017 09:56:43 PM UTCdolorousAttached File-=>Added nanobug.txt, #40659

    Back to the top


    Powered by Savane 3.1-cleanup1