Download Padre

Search, Find and Replace

(the following text was taken from Padre.pm. It needs rewriting.

Search

Ctrl+F opens the search window, if something was selected then that is given as the search text. Otherwise the last search string should be displayed.

Provide option to search backwards

Limit action to current block, current subroutine, current file (should be the default) current project, current directory with some file filters.

When the user presses Find

  • We find the first hit and the search window disappears. F3 jumps to next one.
  • The first match is highlighted and focused but the window stays When the user clicks on the Find button again, we jump to the next hit In this case the user must be able to edit the document while the search window is on.
  • All the matches are highlighted and we go to the first match, window disappears. F3 jumps to next one
  • All the matches are highlighted and we go to the first one, window stays open user can edit text

Find and Replace

  • Find - find the next occurrence
  • Replace all - do just that
  • Replace - if currently a match is selected then replace it find the next occurrence and select it

TODO

Describe what to do if we have to deal with files that are not in the editor == If "Replace all" was pressed then do just that
  1. without opening editors for the files.
  2. opening an editor for each file and keep it in unsaved state (sounds crazy having 1000 editors open...)

if Search or Replace is clicked then we might show the next location in the lower pane. If the user then presses Replace we open the file in an editor window and go on. If the user presses Search then we show the next occurrence. Opened and edited files will be left in a not saved state.

Test

  1. Open {{{lib/Padre/Wx/Main.pm}}} from the Padre source code
  2. Hit Ctrl+F for "Find"
  3. Enter the search term "sprintf"
  4. Click on "Find Next" several times
  5. Make sure that each result is nicely visible in the center of the editor window
  6. Activate "Search Backwards" to change the search direction
  7. Click on "Find Next" several times
  8. Activate "Case Sensitive"
  9. Modify the search term to "Sprintf"
  10. Click on "Find Next": you should not get a hit now
  11. Deactivate "Case Sensitive"
  12. Click on "Find Next": you should get a hit again
  13. Modify the search term to "Wx..gettext"
  14. Activate "Regular Expression"
  15. Click on "Find Next": you should get a hit
  16. Activate "Close Window on Hit"
  17. Click on "Find Next": you should get a hit, and the window should close
  18. Select "Search"->"Find" from the menu: The same search term as before should be in the dialog
  19. Click on "Find All" (remark: currently does not work)
  20. Close the Window
  21. Hit F3: you should get a hit
  22. Hit F3 another time
  23. Hit Shift-F3: you should be back to the former hit