match automatic highlight on NON matching text? lazarus / 9-Editor ---------------------------------------------------------------------- Чебурашка · 2024-04-23 07:17 Hello, I am doing a code refactoring in order to comply with a new coding standard I decided with my team. One of my modifications is this: substitute a parameter of a procedure whose name was "o" (was a o: TObject) with "Aobject". Please nobody laugh on "o" (facepalm). Now my problem is this: I did a replace on local file "o" to "Aobject" with case sensitive and whole word options checked and it works. But since I must be sure of each swap I need to give confirmation of each replace. The problem is that when a match is found, it is automatically selected for being replaced, but along with it, there is also a plenty of NON matches partially highlighted. Why is lazarus showing those invalid ones? What is the sense? Can I prevent this from happening? The lazarus I am telling in this post is the one written below for Linux (2.0.10) ADDENDUM: I know that the feature comes from the automatic highlighting of the selected text, but since the selected text in turn comes from the search itself, I believe it would be more smart to link it to the options asked by the user, that include case sensitivity and whole word in this case. See attached picture. ---------------------------------------------------------------------- Martin_fr · 2024-04-23 07:42 That would be "Highlight current word". If you normally edit the text, then whatever word is at the text- cursor (caret) is highlighted everywhere in the text (after a 1 second wait time). You can find the settings under Tools > Options > Editor > Color: "Highlight current word" Simple "uncheck" the colors (foreground/background/...) and it stops. Also under Tools > Options > Editor > Markup and Matches: you can set the time, and minimum length for full words. But if you select text, it is always the selection. Maybe there should be options for: - toggling "highlight current selection" - disable during search and replace There are some other ways of renaming stuff. Refactor "rename identifier" Source editor, context menu > Refactoring   OR menu: Source > Refactoring. Syncro edit: https://wiki.freepascal.org/New_IDE_features_since#Syncron-Edit Select the entire procedure, then click the icon in the gutter or use ctrl-j. Any word that appears more than once, will be in a "box". Editing it in one place will edit all others. ---------------------------------------------------------------------- Martin_fr · 2024-04-23 07:44 Btw, and without wanting to interfere with your teams guidelines, but have you considered: AnObject instead of Aobject ? ---------------------------------------------------------------------- Чебурашка · 2024-04-23 08:04 Quote from: Martin_fr on April 23, 2024, 09:44:52 amBtw, and without wanting to interfere with your teams guidelines, but have you considered: AnObject instead of Aobject ? Simply we set the convention that all parameters class methods must start with A, regardless of what is after. Then for classes, the fields with start with F while when exposed they will be just . We extended the A rule also to all procs. Of course AnObject is a more elegant English, but then one has to think about when the AnObject has to be tranformed into ASome/Many/Multiple/SeveralObjects or AnObjectsList in case input becomes a list. I prefer a simpler Aobject/Aobjects, taste. ---------------------------------------------------------------------- Чебурашка · 2024-04-23 08:07 Quote from: Martin_fr on April 23, 2024, 09:42:58 amMaybe there should be options for: - toggling "highlight current selection" - disable during search and replace This is what I hoped... Quote from: Martin_fr on April 23, 2024, 09:42:58 amThere are some other ways of renaming stuff. I know that there are some refactoring tools, but I am not confident in them. I my programming life I had bad experiences with blind renaming, so I never use them. Maybe because when I started doing software I used very poor tools. ---------------------------------------------------------------------- WooBean · 2024-04-23 09:15 Quote from: Martin_fr on April 23, 2024, 09:44:52 amBtw, and without wanting to interfere with your teams guidelines, but have you considered: AnObject instead of Aobject ? Just paralel observation from core Lazarus source code -  there are 22 "AIdentifier" and 31 "AnIdentifier" usages. We can survive it, anyway. ---------------------------------------------------------------------- cdbc · 2024-04-23 09:30 Hi Correct english would be: AnObject & AnIdentifier. Elegant too... /AObject/ really hurts my eyes. Just my 2 cents Regards Benny ---------------------------------------------------------------------- Чебурашка · 2024-04-23 09:35 Quote from: cdbc on April 23, 2024, 11:30:08 amHi Correct english would be: AnObject & AnIdentifier. Elegant too... /AObject/ really hurts my eyes. Just my 2 cents Regards Benny Despite I love the beauty of English, I try to focus on efficiency/simplicity because I believe I am not writing prose or poetry, just software. Moreover it is just pascal/delphi IDEs favouring this kind of parameters naming, other languages I worked with don't do the same (C,C++,Java,C#,Ruby,Perl,PHP,VB)