icecoder/ICEcoder

Tweaking/fixing find & replace

Closed this issue · 4 comments

The find & replace system has been completely overhauled in the dynamicPaths branch. It's now far far more efficient (about 117x in tests on a file of 10k lines with 230k chars). Many fixes also put in place, edge cases (eg find & replace on previous working too) and generally better behavior in different circumstances.

A few things remain to fix & improve, listed below:

  • Replace filenames not working (find works, doesn't replace)
  • Find & replace in filenames shouldn't be case sensitive
  • Replace text in a file doesn't update open tab edge case, added as a new issue in #904
  • At present the lines in the results bar will only show if the lines are 0.5 pixels or higher. Instead have 1px lines and consider if there's any results that justify a 1px line being drawn, plus if we have a line, no need to add another. improvement, added as #986
  • The red line in the results bar isn't indicating the current line. Set var to indicate which line we should set as red, all DOM elems have IDs and we set to red after?
  • Case insensitive across everywhere working?
  • "Match Case" - checkbox option also? New feature added to #905
  • "Whole Word" checkbox option also? New feature added to #905
  • "Regex" checkbox option also? New feature added to #905
  • When finding/replacing in fiiles or filenames, is it actually searching on all, as it look a little longer than expected. Update: Yes that's the case. It's needed to some degree if we say select a dir. However, this could be passed through as the base, else pass the filename as the path Issue added #994
  • Replace and replace all in files not working, no JS errors, just not actioning
  • Replace and replace all in filenames not working, no JS errors, just not actioning
  • Check over JS and PHP used in all find & replace Added as an issue for future review when likely everything is completed #995

Test criteria

Testing: result, no result, must be case insensitive, back, forward, cycle over end/start, find in file & dir name

Test results

General

  • With no documents open, type in find box and it errors
  • If you make changes in a couple of open docs, then click close all, it shows an alert - could do with also showing filename

Fine Type: Regular

Find/Replace This document Open Documents Selected/All Files Selected/All Filenames
Find OK OK OK OK
Replace X OK OK OK
Replace All OK OK OK OK

Notes:

Find

  • This Document
    • If your document contains "xyz", find "xyz", it selects 1st result, then add "a" to try to find "xyza", there are no results, then remove "a" it then selects the next xyz match not current Non crucial improvement to make, created issue #987
    • The red block in results bar doesn't always have it set to correct line, sometimes a line out
  • Open Documents
    • Find "xyz" in "this document" to select 1st result, then change to "open documents" and click the link in modal for same file, it jumps to next result in the document, should stay on same? Yes, but not crucial, created issue #988
  • Selected/All Files
    • It looks in binary files too, is that OK? No and shouldn't look in banned dirs either such as .git dir Update: have decided it's OK/more complete to look in binaries. We were only considering filenames not dir names when choosing what to exclude, now resolved.
  • Selected/All Filenames
    • Shows perms?
    • Dir names are clickable and shouldn't be, not a thing you can have in editor

Replace

  • This Document
    • Seems to skip over the next result? (Only when going to next result, not back result) Noted in issue #991
  • Selected/All Files
    • If your search within a file also appears in filename it highlights it too
    • Should display "Replaced X times" when it's done (as it does with Open Documents)
      Should update document also if open (and unsaved). Should also ask before making changes if you have unsaved changes in open document A good idea but not crucial, added to #990
  • Selected/All Filenames
    • Shows always lowercase on found filename
    • Shows perms?
    • Should display "Replaced" when it's done (as it does with Open Documents)

Replace All

  • Selected/All Files
    • Should display "Replaced X times" when it's done (as it does with Open Documents)
    • Should update document also if open (and unsaved). Should also ask before making changes if you have unsaved changes in open document A good idea but not crucial, added to #990
  • Selected/All Filenames
    • Shows always lowercase on found filename
    • Shows perms?
    • Should display "Replaced" when it's done (as it does with Open Documents)

Test criteria

Testing: result, no result, must be case insensitive, back, forward, cycle over end/start, find in file & dir name

Test results

General

  • With no documents open, type in find box and it errors (eg [a])
  • With documents open, type []] (or (() as another example) and it errors

Fine Type: Regex

Find/Replace This document Open Documents Selected/All Files Selected/All Filenames
Find OK OK X X
Replace X X X OK
Replace All OK OK X OK

Notes:

Find

  • This Document
    • If your document contains "xyz", find "xyz", it selects 1st result, then add "a" to try to find "xyza", there are no results, then remove "a" it then selects the next xyz match not current Non crucial improvement to make, created issue #987
    • The red block in results bar doesn't always have it set to correct line, sometimes a line out
  • Open Documents
    • Find "xyz" in "this document" to select 1st result, then change to "open documents" and click the link in modal for same file, it jumps to next result in the document, should stay on same? Yes, but not crucial, created issue #988
  • Selected/All Files
    • Didn't regex find word in file, just regular
  • Selected/All Filenames
    • Should regex bold highlight the match part, only does this if regular

Replace

  • This Document
    • Next doesn't seem to go to next, prev does but doesn't replace (note: replacing this in Open docs works fine) Replacing previous seems to work fine but replacing next doesn't, however this issue raised under #991
  • Selected/All Files
    • Didn't find results that are there
    • Should update document also if open (and unsaved). Should also ask before making changes if you have unsaved changes in open document A good idea but not crucial, added to #990
  • Selected/All Filenames
    • Should regex bold highlight the match part, only does this if regular
    • Shows same filename to replace with? (Note: doesn't have this issue with regular find)

Replace All

  • Selected/All Files
    • Didn't find results that are there
    • Should update document also if open (and unsaved). Should also ask before making changes if you have unsaved changes in open document A good idea but not crucial, added to #990
  • Selected/All Filenames
    • Should regex bold highlight the match part, only does this if regular
    • Shows same filename to replace with? (Note: doesn't have this issue with regular find)

Find in filenames also seems to scan only the DIVs in client, not scan the filenames on server.

Doesn't allow you to select all filenames as option till you click a file and then deselect it.

  • Created issue #992

Most items covered here and the find & replace system is so so much better. A few somewhat important items and some ideas to cover but the core items that simply weren't working in this issue now resolved.

Will close the issue and the new issues that were raised based off findings here to be planned for upcoming releases.