Menu

Search and Replace

linknet
2017-05-24
2018-10-31
  • linknet

    linknet - 2017-05-24

    Hi Curtis,

    As if I haven't given you enough work here is some more.

    I've created a search and replace version for you to have a look at. The idea is that you perform a search and when satisfied that the search contains all of the items to be replaced you then select replace mode. A valid search is required so any changes made to the search criteria invalidates the search and disables the replace option requiring that the search performed again. Files can be removed from the file list without invalidating the search but any other changes such as opening a  file for editing or changing the search options such as the exclusions, the search path, the search file pattern or the search text and a few more which I haven't listed invalidate the search.

    Once in replace mode the search criteria are fixed and after entering the text for replacement, and choosing whether to create backup files, selecting replace carries out the operation. You then are presented with the option of applying or cancelling the replace operation. Cancelling will allow the replace to be repeated with different criteria or just return to search mode. Selecting apply will finalise the replace operation and return to search mode.

    However, from a users point of view the application still works and looks the same except that there is an added replace mode button, so it shouldn't upset any users wanting just the previous search functions only.

    An additional feature is that the search or replace text displayed in the results window can be shown surrounded by brackets, the colour of which can be changed in the applications options. This can make it far easier to identify the search or replace text when handling repetitive strings or regular expressions.

    Since the plugins don't allow for text replacement the fact that the file was handled by a plugin is shown in the file list window with a different colour text for identification purposes only.

    I've attached a portable version for you to have a look at to either accept, reject or suggest changes. If it were to be accepted I'll then post the modified code, since at the moment, whilst I think that I've found all of the bugs I'm still checking.

    I've set this as version 5.0.0 since in my opinion the changes would warrant a major version number change, but that would be your decision. 

    Regards

    Roger

     

    Last edit: linknet 2017-05-30
  • linknet

    linknet - 2017-05-24

    See last post.

     

    Last edit: linknet 2017-05-29
  • Jackslade

    Jackslade - 2017-05-24

    Thanks for your effort on this as well!

    I'll take a look when I have a chance and give any feedback.

    Curtis

     
  • linknet

    linknet - 2017-05-29

    Here's the portable version 5.0.0 - (based on latest 4.4.6)

     

    Last edit: linknet 2017-05-31
  • Jackslade

    Jackslade - 2017-05-31

    Just briefly looking over it, I like it and it is a good start for sure.

    In my head, for v5, I was thinking I originally wanted to rewrite the interface with wpf (so it better supports high dpi and all of that and to update it to feel more modern). I was also going to include the replace feature and hopefully some other long requested user features.

    Perhaps that is more a 6.0 release now :)

    Let me continue to review and test it some more and I will get back to you on any comments.

    Thanks Roger!

     
  • linknet

    linknet - 2017-05-31

    Sounds good :)

    This fixes a bug, not just in this but in previous versions, where the "Remove Leading Whitespace" menu option doesn't work with the menu item "Show Entire File" selected.

    I'll post the fix and the code when I get time, you might be able to find a more elegant solution by including it in a line transformer, I tried but was unsuccessful. Anyway, this works:

     

    Last edit: linknet 2017-05-31
  • linknet

    linknet - 2017-06-03

    This updates the language files for replace mode and fixes one or two minor bugs:

     

    Last edit: linknet 2017-06-04
  • linknet

    linknet - 2017-07-25

    Here's the code:

     
  • linknet

    linknet - 2017-08-01

    There's a bug in version 4.4.6 which is obviously also in version 5.0.0.

    It shows up when searching for spaces in a file with leading spaces, either directly or by using the regular expressions \s or \s+.

    Selecting the menu option 'Remove Leading Spaces' hides the first leading space match in every line and consequently corrupts the highlighting of any subsequent space matches in the line.

    The only reasonable solution I could come up with was to display the leading space matches, not hide them, since they are actually valid matches. This is achieved for each match line by only removing leading spaces up to the start of the first match.

    I've included the fix in this version together with the revised code:

     

    Last edit: linknet 2017-08-01
    • Jackslade

      Jackslade - 2017-08-01

      Thanks I'll take a look at think about that more.

       
  • linknet

    linknet - 2017-08-01

    This is the same fix but applied to 4.4.6

     
  • linknet

    linknet - 2017-08-02

    Exactly the same result but changed the code slightly:

     

    Last edit: linknet 2017-08-02
    • Jackslade

      Jackslade - 2017-08-12

      Thanks, will review and decide next step. Thanks again for all your work!

       
  • linknet

    linknet - 2017-08-19

    Inspecting the Microsoft Word plugin code revealed that although most of the hard work to access the com objects etc. had been completed the code to display context lines was unfinished. The intention appears to have been to display context lines based on line and page numbers but the Word Application doesn't really support this. MS Word lines are actually paragraphs (each line word wraps and continues until a carriage return is inserted) and pages are only hard coded if you specifically add page breaks.

    So treating each paragraph as a line here is the MS Word plugin with context lines and, as an added bonus, with support for regular expressions.

    The System File Handler code was fairly similar so it was simple to add the context line support to this plugin as well.

    I'm not sure how your review of this is progressing, I think that you had concerns over the UI flow?

     

    Last edit: linknet 2017-08-29
    • Jackslade

      Jackslade - 2017-08-21

      Thanks, I'll take a look at these changes as well and see about adding them.

      I've been swamped at work this last month so haven't had to much motiviation to do more afterwards. Will try and review it more in the next couple of weeks.

      Thanks for all of your hard work on this. Appreciate the help!

       
  • ben brown

    ben brown - 2018-10-31

    gents, i just used v5.0.0 to do a find and replace through a load of XML files and it worked like a charm... thanks for all your efforts, great bit of software.

     

Log in to post a comment.