#448 Regex search and replace refactor and fix

Next_major_release
closed
Don HO
None
9
2013-02-11
2013-01-20
No

This is the big search and replace fix & refactor. Lots of improvments from François-R Boyer. Search and replace now supports zero length matches properly.

See the discussion thread here: https://sourceforge.net/p/notepad-plus/discussion/331753/thread/77d5ad08/?page=1

The patch can be applied with the GNU patch utility (rename on windows 7+ to patxch.exe to avoid UAC issues)

c:\utils\patxch -i ..\patches\0001-Find-Replace-refactored-and-improved.patch -p 1

Obviously replace ..\patches\0001-Find-Replace-refactored-and-improved.patch with the path to the extracted patch file. Run from the root npp directory.

Patch should apply cleanly to 6.2.3 sources.

1 Attachments

Discussion

  • Don HO

    Don HO - 2013-01-23

    I executed the following line (under Windows 8):
    d:\source\Notepad++\trunk>D:\Appz\gnuPatch\bin\paxtch.exe -i .\0001-Find-Replace-refactored-and-improved.patch -p 1
    But I get a crash message:
    "Patch: apply a diff file to an original stopped working".
    What have I done wrong?
    Is there an alternative way to apply patch?

    Don

     
  • Dave Brotherstone

    I used patch.exe from unxutils project on sourceforge (under win7) - I'm not sure if gnuPatch is the same... Also make sure the patch has windows line endings - I thought I'd checked that though (maybe gnuPatch needs unix line endings?)

    Dave.

     
    • Don HO

      Don HO - 2013-01-23

      Downloaded UnxUtils from here:
      http://sourceforge.net/projects/unxutils/?source=dlp

      It still crashed on my Windows 8 machine:
      //============================================
      d:\source\Notepad++\trunk>D:\Appz\unxutils\usr\local\wbin\patxch.exe -i .\0001-F
      ind-Replace-refactored-and-improved.patch -p 1
      patching file `PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp'
      Assertion failed: hunk, file patch.c, line 321

      This application has requested the Runtime to terminate it in an unusual way.
      Please contact the application's support team for more information.
      //============================================

      I guess the binary generated with gcc compiler is not compatible with windows 8 (the nppCM.dll suffered the same issue).

      I'll find a work around.

      Don

       
      Last edit: Don HO 2013-01-23
      • Don HO

        Don HO - 2013-01-23

        Just tried the same steps above under windows 7 - the same crash.
        Is it possible to download the whole source code then I merge myself?
        It'll be the easist way imo.

        Don

         
  • Dave Brotherstone

    I've no idea why that doesn't work - I've done exactly the same command on the same source and it worked no problem.

    I've attached the full versions of the files that have been changed or added. Please include the test folder under scintilla - we've added some tests for the regex stuff.

    Cheers,
    Dave.

     
    Last edit: Don HO 2013-01-25
    • Don HO

      Don HO - 2013-01-25

      Thank you Dave.
      The patch (including all scitilla unit tests) is committed in repo (rev.1009).
      I will do the 6.3 RC ASAP.

      Thank you (Dave and François) for your terrific work!

      Don

       
  • Don HO

    Don HO - 2013-01-25
    • status: open --> accepted
    • priority: 5 --> 9
     
  • Dave Brotherstone

    Don,
    In day to day usage, ive spotted a problem with the incremental search. I've got an easy fix for it. I'll add the patch to this thread this afternoon. Not had chance to prepare it yet.

    Dave

     
  • Dave Brotherstone

    Fix for incremental search attached.

    I've also spotted that reverse regex replaces don't work - reverse regex finds are ok, but the replace is broken. I've had a quick look and can't see anything obvious.

    Unfortunately, I'm ill at the moment, and can't see me doing anything until early next week. I would be inclined to disable reverse regex as it was in 5.9, and then we'll enable it when we've got it fixed.

     
    • Don HO

      Don HO - 2013-01-27

      Thank you Dave.

      committed in rev.1013
      Hope you'll be fine soon.

      Take care,
      Don

       
  • Don HO

    Don HO - 2013-02-11
    • status: accepted --> closed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks