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

 
 

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

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

Submitter:  David Lawrence Ramsey <dolorous>
Submitted:  Wed 10 May 2017 09:56:43 PM UTC
   
 
Severity:  4 - Important Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

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

Pushed, 28beb3f9.  Thanks for testing.

Benno Schulenberg <bens>
Group administrator
Fri 12 May 2017 07:49:09 PM UTC, comment #3: 

Looks good to me, after some quick testing.

David Lawrence Ramsey <dolorous>
Group Member
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>
Group administrator
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>
Group administrator
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>
Group Member

 

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

Attached Files
file #40659:  nanobug.txt added by dolorous (100B - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Date Changed by Updated Field Previous Value => Replaced by
    2017-05-19 bens Open/ClosedOpen Closed
    2017-05-12 bens StatusIn Progress Fixed
    2017-05-11 bens Attached File- Added 0001-replacing-don-t-let-placewewant-influence-the-placem.patch, #40668
        StatusNone In Progress
    2017-05-11 bens Severity3 - Normal 4 - Important
        Assigned toNone bens
    2017-05-10 dolorous Attached File- Added nanobug.txt, #40659

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code