Recent

Author Topic: search and replace all fails after "no"  (Read 2149 times)

lazer

  • Full Member
  • ***
  • Posts: 215
search and replace all fails after "no"
« on: October 23, 2022, 12:49:45 pm »
Hi,

unless I'm mistaken search/replace is broken.

cntl-F  : add search string, check replace, define replace string, check prompt on replace ; click replace all 

First instance does not need changing so I click "no" when asked " replace this occurance?".

BYE BYE. !

Game over. Global search/replace is finished.  This is exactly the same as if I clicked Cancel, which I would indeed expect to end the operation.

Surely with the age of this project basics like that must be working ?
Has someone broken this recently ?
(I'm running lazarus-main from yesterday )
Lazarus 2.3.0 (rev main-2_3-2165-gc63984efd6) FPC 3.3.1 x86_64-linux-gtk2

TIA.

bytebites

  • Hero Member
  • *****
  • Posts: 640
Re: search and replace all fails after "no"
« Reply #1 on: October 23, 2022, 02:10:04 pm »
Why do you use such a crap program (in your words)?
You promised not to use it.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9868
  • Debugger - SynEdit - and more
    • wiki
Re: search and replace all fails after "no"
« Reply #2 on: October 23, 2022, 02:20:01 pm »
It works here.... (with latest Lazarus 2.3 from 5 minutes ago) 
Tested on Windows, but that should not make a diff in this case.

I tested "Origin": From cursor / From beginning
"Search Scope" = Global
"Direction" = Forward

Pressing "no" did prompt me for the next occurrence.

However, if there is no next occurrence, it will silently stop.
It did not say "no more found".
It also does not say "no more found" if the search term does not exist at all. So it seems there is no "no more found" message.



Btw... a bit off topic, but sometimes of interest when "replace" = "edit multiple occurrences"

Syncro edit: https://wiki.lazarus.freepascal.org/New_IDE_features_since#Syncron-Edit
Multi caret: https://wiki.lazarus.freepascal.org/New_IDE_features_since#Multi_Caret
Rename Identifier: https://wiki.lazarus.freepascal.org/Lazarus_IDE_Tools#Rename_Identifier

"Rename Identifier" Does not always catch all (e.g. in some cases inheritance), but it can distinguish between a field and a local or global var, etc.
« Last Edit: October 23, 2022, 02:23:03 pm by Martin_fr »

lazer

  • Full Member
  • ***
  • Posts: 215
Re: search and replace all fails after "no"
« Reply #3 on: October 23, 2022, 03:21:47 pm »
Thanks for testing. This kind of dlg context is the sort of thing where platform dependent bugs can occur. I wondered if was and empty search but I had about 10 occurrences to do, and I checked a couple of times to ensure I was seeing what I thought I was seeing.



dseligo

  • Hero Member
  • *****
  • Posts: 1221
Re: search and replace all fails after "no"
« Reply #4 on: October 23, 2022, 05:22:31 pm »
It works fine in Lazarus 2.2.4 in Windows 11.

P.S.: And it works in Lazarus 2.3.0 (rev main-2_3-2666-ge150356a73).

Maybe you messed something when you were solving debugger problems?
« Last Edit: October 23, 2022, 05:27:08 pm by dseligo »

lazer

  • Full Member
  • ***
  • Posts: 215
Re: search and replace all fails after "no"
« Reply #5 on: October 23, 2022, 05:47:03 pm »
Quote
Maybe you messed something when you were solving debugger problems?
Nothing to do with it. I'm running latest pull for both fpc and laz.

When I have a problem on Linux, it's not a rebuttal to test it on Windoze.

Code: Pascal  [Select][+][-]
  1.   oldpack:=pack;
  2.   if packreq>9 then str(packreq:2,tmpstr)
  3.   else tmpstr:=char(packreq+48);
  4.  

I do F3 on the first occurrence of packreq and try to replace with pakreq. If I say No to first replacement it ends.
« Last Edit: October 23, 2022, 05:50:32 pm by lazer »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9868
  • Debugger - SynEdit - and more
    • wiki
Re: search and replace all fails after "no"
« Reply #6 on: October 23, 2022, 06:02:34 pm »
I do F3 on the first occurrence of packreq

Meaning ...
1) you use "f3" to open the dialog, and do a new search and replace? (like ctrl-F)
2) you already have search/replace values, and use F3 to continue a replace (that you had previously stopped)?

It shouldn't make a diff, but just to be sure...

And also: your scope is global?
This is not a "replace in selection only"?

lazer

  • Full Member
  • ***
  • Posts: 215
Re: search and replace all fails after "no"
« Reply #7 on: October 23, 2022, 06:51:19 pm »
Sorry, lack of accuracy there, it was indeed ctl-F3 as stated in OP.

Yes, scope is global. From cursor, global, forwards.

Cursor to give the expected first match.
« Last Edit: October 23, 2022, 07:17:28 pm by lazer »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9868
  • Debugger - SynEdit - and more
    • wiki
Re: search and replace all fails after "no"
« Reply #8 on: October 23, 2022, 07:28:55 pm »
Well, in theory it works on linux too.

But there is a crash in the gtk backend. (not sure if that is for "no" only, or can happen otherwise too.
Not sure since when....

https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39967


lazer

  • Full Member
  • ***
  • Posts: 215
Re: search and replace all fails after "no"
« Reply #9 on: October 23, 2022, 08:33:39 pm »
"Yes" seemed a little challenged too.  On clicking yes it closed but it appeared to have done all without asking. I confused me at first since I was expecting prompts and I thought it just did one are crapped out. Then I tried to repeat to do the next one and they were all done.

Did not check this thoroughly ( I'm going to be using Geany to edit my pascal code soon ! ).

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: search and replace all fails after "no"
« Reply #10 on: October 23, 2022, 10:42:55 pm »
I confused me at first since I was expecting prompts and I thought it just did one are crapped out.
There's a "prompt on replace" checkbox for that.

Bart

lazer

  • Full Member
  • ***
  • Posts: 215
Re: search and replace all fails after "no"
« Reply #11 on: October 23, 2022, 10:47:16 pm »
Quote
There's a "prompt on replace" checkbox for that.
Plese try to read at least the first post before attempting to comment.


Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: search and replace all fails after "no"
« Reply #12 on: October 23, 2022, 11:51:37 pm »
Quote
There's a "prompt on replace" checkbox for that.
Plese try to read at least the first post before attempting to comment.
Sorry.

Bart

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9868
  • Debugger - SynEdit - and more
    • wiki
Re: search and replace all fails after "no"
« Reply #13 on: October 24, 2022, 05:41:27 pm »

It may be (but there is no certainty) that running
Code: Text  [Select][+][-]
  1. lazaurs --sync
may remove (or significantly reduce) the issue.

lazer

  • Full Member
  • ***
  • Posts: 215
Re: search and replace all fails after "no"
« Reply #14 on: October 24, 2022, 05:55:08 pm »
 significantly reduce ?  It's a binary issue, either it does the global S/R or it stops when I chose "no" on an individual change.
what does lazarus --sync do ?

« Last Edit: October 24, 2022, 05:57:56 pm by lazer »

 

TinyPortal © 2005-2018