SourceForge has been redesigned. Learn more.

#253 "Replace All - In Selection" operates outside selection

General (289)

Geany SVN is messing up when doing a regex-replace inside a selection. This example replaces "^" with "\t" (typical operation to add indentation), and as the attached screenshots clearly show, the line immediately following the selection is affected as well.


  • Nick Treleaven

    Nick Treleaven - 2009-01-20

    Well, you have the end of line selected. Not sure how this could be improved.

  • Nick Treleaven

    Nick Treleaven - 2009-01-20
    • priority: 5 --> 3
  • Daniel Richard G.

    The behavior is technically correct (the string selected is "bar\nbaz\nqux\n" and /^/ matches at the end), but wrong in terms of user interface. If you wanted to indent "bar", "baz" and "qux", it's not sensible that you would select only the lines containing the first two, or leave off the newline after "qux".

    For reference, NEdit 5.5 (in source/search.c:3751) has this bit of code, right after the search bit, and before the replace bit:

    /* Make sure the match did not start past the end (regular expressions
    can consider the artificial end of the range as the end of a line,
    and match a fictional whole line beginning there) */
    if (startPos == selEnd - selStart) {
    found = False;

    I consider this representative of the "expected" behavior, and would presume that similar logic is present in other editor implementations.

    (FYI: There aren't any other special cases of this nature in the vicinity of the source, which leads me to believe that this is the only one needed.)

  • Colomban Wendling

    I can't reproduce the issue anymore, perhaps the regex engine change fixed that? Please give further details if you still suffer of the issue.

  • Colomban Wendling

    • status: open --> pending-out-of-date
  • Colomban Wendling

    • status: pending-out-of-date --> closed-out-of-date
    • Found in: --> Unknown
    • Fixed in: --> None

Log in to post a comment.