search and replace all fails after "no" lazarus / 9-Editor ---------------------------------------------------------------------- lazer · 2022-10-23 10:49 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 · 2022-10-23 12:10 Why do you use such a crap program (in your words)? You promised not to use it. ---------------------------------------------------------------------- Martin_fr · 2022-10-23 12:20 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_Too ls#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. ---------------------------------------------------------------------- lazer · 2022-10-23 13:21 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 · 2022-10-23 15:22 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? ---------------------------------------------------------------------- lazer · 2022-10-23 15:47 QuoteMaybe 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][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   oldpack:=pack;  if packreq>9 then str(packreq:2,tmpstr)  else tmpstr:=char(packreq+48);  I do F3 on the first occurrence of packreq and try to replace with pakreq. If I say No to first replacement it ends. ---------------------------------------------------------------------- Martin_fr · 2022-10-23 16:02 Quote from: lazer on October 23, 2022, 05:47:03 pmI 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 · 2022-10-23 16:51 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. ---------------------------------------------------------------------- Martin_fr · 2022-10-23 17:28 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 · 2022-10-23 18:33 "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 · 2022-10-23 20:42 Quote from: lazer on October 23, 2022, 08:33:39 pmI 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 · 2022-10-23 20:47 QuoteThere's a "prompt on replace" checkbox for that.Plese try to read at least the first post before attempting to comment. ---------------------------------------------------------------------- Bart · 2022-10-23 21:51 Quote from: lazer on October 23, 2022, 10:47:16 pmQuoteThere'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 · 2022-10-24 15:41 It may be (but there is no certainty) that running Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i lazaurs --syncmay remove (or significantly reduce) the issue. ---------------------------------------------------------------------- lazer · 2022-10-24 15:55 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 ? ---------------------------------------------------------------------- Martin_fr · 2022-10-24 16:27 "--sync" goes to the gtk/gdk toolkit (the libraries that come with the OS). It switches them to run synchronous instead of asynchronous. (see the issue report I linked earlier => the OS dumped a message in which it points out the "--sync") "significantly reduce" Actually, my current guess is, that it is a race condition (gtk/gdk has several threads). E.g. when I run lazarus normally (without --sync) it does not always happen. Sometimes it only happens on the 2nd or 3rd "no". So it happens with a certain likelihood. (as race conditions do) Running synchronously may fix the race entirely, but it could also just reduce its likelihood of going wrong. Mind, that is "my guess" only. I don't have enough background on gtk/gdk. Well, then of course, each Linux distro, and each version thereof (or rather each version(s) of gtk/gdk) may react different. On some it may always work flawlessly. On others it may break, but with different likelihood.... ---------------------------------------------------------------------- lazer · 2022-10-24 19:13 Thanks for the explanation, that does seem to make it work !  Good catch. That makes life a bit easier, at least. ---------------------------------------------------------------------- lazer · 2022-10-27 13:53 More anomalies , now running with --sync cntl-F3 to set up S/R , click YesToAll . Does a single replace. Subsequent F3 shows a reduced dlg with just the buttons, this time YesToAll does the job. ---------------------------------------------------------------------- Martin_fr · 2022-10-27 14:57 I can not reproduce this. In fact, I checked a bit more on the "no" issue. Testing without "-- sync" I could only reproduce it on:  Fedora 33  (64 bit)  But it did not happen for me on any of (yes they are older) Debian 11  (32 bit) Mate 20.1    (64 bit) Fedora 28  (64 bit) Ubuntu 20  (64 bit) So maybe (maybe not) there as a bad gtk version on my Fedora 33. In any case that needs to be looked at by someone with more gtk background than I have. I run those tests, because I had started to wonder how such an issue could go by and no one (before you) would notice. I can't tell what the likelihood is for it being a Lazarus issue, or a broken gtk library (from a Linux distro)... That someone else will have to establish. ---------------------------------------------------------------------- lazer · 2022-10-27 16:10 Cool, just for the record I'm running Fed35, which is still supported but there is a new stable F36. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Installed PackagesName         : gtk2Version      : 2.24.33Release      : 7.fc35Architecture : x86_64 ---------------------------------------------------------------------- Martin_fr · 2022-10-27 16:32 Oh, one think I forgot. The failing system is also the only system on which I use AnchorDocking. Do you use AnchorDocking? ---------------------------------------------------------------------- Martin_fr · 2022-10-27 16:52 Yea, just build without AnchorDocking, and it works.  (Or at least it did not crash for a dozen "no") ---------------------------------------------------------------------- lazer · 2022-10-27 17:04 I've no idea what that is , how do I build without it ? ---------------------------------------------------------------------- Martin_fr · 2022-10-27 17:35 Quote from: lazer on October 27, 2022, 07:04:48 pmI've no idea what that is , how do I build without it ? AnchorDocking allows you to have a "one windows Lazarus". You can "attach" (dock) all the floating windows. https://wiki.lazarus.freepascal.org/Anchor_Docking#Installation It is not installed by default. But my tests may be flawed, for if it is a race condition (or dangling ptr / or both), any change (even entirely unrelated) can affect the outcome. E.g. with Anchordocking I have for less Windows on the screen (in my case just 2, instead of half a dozen or more).