Search and replace in the editor lazarus / 9-Editor ---------------------------------------------------------------------- new2linux · 2016-06-06 16:12 One of the main points of frustration in the editor is the Search and Replace. Are there any plans to change this? Want to know why? The list quite impressive (using the defaults): - buggy: ReplaceAll sometimes skips the selected replacement text, other times it doesn't - so often I have to go back to the top of the archive, to then repeat ReplaceAll - but going from the top the behaviour is different, ReplaceAll now goes ahead and replaces everything, whereas before it would prompt me every time. - the Alt+R shortcut has 2 targets in the S&R dialog and selects the wrong one, ReplaceWith - ReplaceWith is redundant, it should activate through ^F and ^H shortcuts, also within the dialog. I know, these shortcuts are configurable, so that creates a (solvable) problem. - we have to TAB through ReplaceWith every time. how many times did I start typing in vain. - the main S&R dialog is replaced by another, ambiguous one, to confirm each replacement. I have to back out and back in to change an option. Notepad++ uses just one  dialog and doesn't have this problem. - there is no option to use regular expressions I suggest to remodel the current behaviour after Notepad++, because it is quite hard to get right. Thanks for considering. ---------------------------------------------------------------------- balazsszekely · 2016-06-06 16:22 Feel free to provide a patch:   - http://bugs.freepascal.org/my_view_page.php   - http://wiki.lazarus.freepascal.org/Creating_A_Patch  but first you should ask the developers:   - http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus PS: You can find the dialog under: $(LazarusDir)/IDE/findreplacedialog.pas. First you should build the DebugIDE profile(Lazarus Menu-->Tools-->Configure Build Lazarus, then open $(LazarusDir)/IDE/lazarus.lpi and debug the dialog if you like. ---------------------------------------------------------------------- Martin_fr · 2016-06-06 16:54 Quote from: new2linux on June 06, 2016, 06:12:54 pm- buggy: ReplaceAll sometimes skips the selected replacement text, other times it doesn't Try to make a reproducible example and report on the bugtracker. Hint, maybe it relates to the direction of selecting text. i.e. selecting backwards from last to first char. Quote- but going from the top the behaviour is different, ReplaceAll now goes ahead and replaces everything, whereas before it would prompt me every time. that should only depend on yes to all. Again steps to reproduce and bugtracker Quote- the Alt+R shortcut has 2 targets in the S&R dialog and selects the wrong one, ReplaceWith bugtracker Quote- ReplaceWith is redundant, it should activate through ^F and ^H shortcuts, also within the dialog. I know, these shortcuts are configurable, so that creates a (solvable) problem. - we have to TAB through ReplaceWith every time. how many times did I start typing in vain. Matter of opinion. Other editors have combined find/replace dlg too, but use tabs. However changing the tab often acts exactly like our checkbox, that is the text in all other inputs is kept the same when toggling. Quote- the main S&R dialog is replaced by another, ambiguous one, to confirm each replacement. I have to back out and back in to change an option. Notepad++ uses just one  dialog and doesn't have this problem. Matter of opinion. Both have advantages. The big n++ dialog covers too much of the editor. Also it has no preview of the replacment in case of regex placeholders (replace "x(..)" with "foo$1" does not preview what "foo$1" will actually be.) But I guess a patch for somewhere in the middle would not cause any issue. A patch could add a button to the confirm dlg the reopens the initial dlg. Quote- there is no option to use regular expressions For me there is a regex opt (in Lazarus) ---------------------------------------------------------------------- new2linux · 2016-06-06 18:26 QuoteMatter of opinion. Other editors have combined find/replace dlg too, but use tabs. However changing the tab often acts exactly like our checkbox, that is the text in all other inputs is kept the same when toggling. I am not talking about the concept of combining dialogs. Other editors also have a combined dialog, but the execution does not get in the way of the most commonly used flow: 1. fill in the search (indifferent of how you got here using Ctrl+F or Ctrl+H),   1a Ctrl+H (or Ctrl+TAB) to enable the replace box, if it wasn't, optional and infrequent 2. TAB and fill in the replace, 3. ENTER, NextMatch or &All, done. Whereas a common flow on Lazarus is: 1. fill in the search (indifferent of how you got here using Ctrl+F or Ctrl+H), 2. TAB to skip the ReplaceWith check, always, no option here    2b SPACE to toggle the check, at a moment we don't want to think about options yet.. 3. TAB and fill in the replace,   3a WTF? nothing registered! oh I see Lazarus is different from everybody else and need another TAB.   3b. type again. 4. ENTER and then *click* because Alt+R does not work, and helpfully *removes* the Replace button... 5. Select Replace All   5a the dialog changes, to go back one must abort and reenter the flow, so much for a single dialog, and googluck with a partial edit. 6. Go back to the top to repeat at step 1 because the default should be to wrap the operation until the point the operation was initiated. Now a minor part of this is the defaults. The bigger issue, one that the other points only reinforce, is that there are a lot of unexpected bumps in the flow. Lazarus would benefit significantly from streamlining this a bit. But I guess that won't happen anytime soon. Ok. Oh well, Lazarus is still the only option for a lot of us. I won't be patching anytime soon, so thank you for your time. ---------------------------------------------------------------------- Martin_fr · 2016-06-06 20:01 Well I get your point. I still dont consider it a bug, even if it can be improved. When I said "matter of opinion" I didnt mean that as rejection, but merely as leaving it open for discussion, while other issues could go straight to the bug tracker. [1] IIRC there was (but for other reasons) once some work with tabs, and that did not go well (dont remember why). Still possible that it will be accepted for the reasons you gave. It probably would even be a very simple change (just change the checkbox for a tab control (NOT page control). [1] That said, you are free to open an bugtracker issue on that too, and see if/when some one picks it up. You can also try to find out if a patch would be accepted... ---------------------------------------------------------------------- Ondrej Pokorny · 2016-06-08 09:11 Quote from: Martin_fr on June 06, 2016, 06:54:52 pmQuote from: new2linux on June 06, 2016, 06:12:54 pm- buggy: ReplaceAll sometimes skips the selected replacement text, other times it doesn't Try to make a reproducible example and report on the bugtracker. AFAIK I fixed this. Do you test with trunk?