#609 "^" doesn't match all lines

development
closed-accepted
Tony Balinski
Program (402)
9
2008-10-06
2008-01-12
Bert Wesarg
No

To reproduce:

start nedit in a clean NEDIT_HOME

create the following document and move the cursor back to the beginning:

-----cut-----
1
2
3

5
6
7
-----cut-----

open the search dialog in 'regex' and 'keep' mode and search for "^"

keep pressing "Find" to cycle through all lines

you will see that line 5 is never matched

NEdit release of Jan 12, 2008

Built on: Linux, 486, GNU C
Built at: Jan 12 2008, 10:26:44
With Motif: 2.2.3 [@(#)Motif Version 2.2.3]
Running Motif: 2.2 [unknown]
Server: The X.Org Foundation 10300000
Visual: 16-bit TrueColor (ID 0x23, Default)
Locale: en_US.UTF-8

Discussion

<< < 1 2 (Page 2 of 2)
  • I am maintaining some source code which was not originally written by me. Sometimes the work was just as simple as some search/replace with nedit. It is really scared to know this bug in nedit as this is about the very basic function of a text editor. I think we need to have a fix in the next release.

     
  • Tony Balinski
    Tony Balinski
    2008-10-01

    The problem lies in search.c: SearchAndSelect(). If there's a current matching "selection" (even zero-length IIUC), search starts at the start of this selection +/-1 depending on direction; otherwise the current cursor position is used, -1 for backward searches (variable beginPos). Now if a forward search matches *at* this start position, and is zero-length, the search is repeated at beginPos + 1. This is correct when beginPos was set to the cursor position, but this second search shouldn't be done if beginPos was based on current selection, because it has *already* been incremented.

    I have fixed my source code but cannot just now apply my change to the CVS repository. (I'm getting "ssh_exchange_identification: read: Connection reset by peer". Any ideas?)

     
  • waiting for your fix...

     
  • fixed not been committed to 5.6-BETA!!!

     
  • Tony Balinski
    Tony Balinski
    2008-10-06

    • assigned_to: nobody --> ajbj
    • status: open-accepted --> closed-accepted
     
  • Tony Balinski
    Tony Balinski
    2008-10-06

    It is now.

    As it was checked in on MAIN already, and tried by others, I'm closing this now. Anybody finding some other fault can reopen if needs be.

     
<< < 1 2 (Page 2 of 2)