Replace - shortcomings

I have read several entries about the find and replace functionality. However - I am very unhappy with it and I can't find an answer here yet.

My issue: When I want to replace something in a defined section I get per default all occurences in all files displayed. But even just in my one file there is a long list of places coming up with no way to identify, where each of these occurences actually is.

I have attached a screenshot, not sure how that will show up in the forum.
On the right the section marked where I want to replace the sequence '[0]['
To the left I get 436 results with no indication where they actually are and where the selected section is.

I can't find options to 'Replace in selected section only' or so. Is it me, am I doing something wrong?
IDE2.x is great, the replace function so far has been a pain and a risk. Just as a feedback.

Have you tried Ctrl + H when in the editor rather than using the "magnifying glass" icon ?

It has the option to "Find in Selection"

1 Like

If you select a search result then the editor panel will be scrolled to the location of the result and the result will be highlighted in the code.

This means, I have to click through the list to the left in order to find - step by step or rather click by click - the section, I have already highlighted? Seriously?

BTW: Even then - the selection in the Editor Window is then gone. Its pretty weird .....

If you want a "Find in Selection" capability, then use the "Find" interface as explained by @UKHeliBob.

That is because the search result is selected in the editor panel when you click on the result in the Search panel.

Sorry, this is becoming pretty complicated for a very simple function.

  • I want to replace something, probably a number of occurences , else I would just edit.
  • I select the section, where I want certain sequences of text/code to be replaced by someting else
  • When selecting 'Replace' as a function I now expect that a tool/windows pop ups, that offers me to replace something IN THE SECTION I HAVE HIGHLIGHTED before I chose the tool 'Replace'. This is 'good' software practise in thousands of applications.

I dont understand the suggestions I get here.

Have you tried the procedure described by @UKHeliBob in post #2?

If there is anything you didn't understand about that description, I would be happy to provide more detailed directions.

The design of Arduino IDE's Search and Find interfaces comes from VS Code, which has been ranked as the world's most popular programming editor for the last 6 years. Millions of developers must not be too bothered by this design.

1 Like

Sorry for delayed response - I am not fulltime on these things.

I have tried the proposal to use Ctrl + H but I dont get what it gives me. It is still not limiting the search & replace area to the area I have selected on beforehand. I don't get it.

.... and when I see all these search results to the left - how could I know where each of these entries/finds actually is ? (????) There is no line no., no indicator ... its just a bunch of text ....

What is this good for`?

I dont know why VS Code is most popular but I guess it is not for the Search and Replace functionality. A general statement or assessment doeesn't necessarily apply to any detail of a software or might be even in contrary.

Take a look at the partial screen shot in post #2 Hover over the icon to the right of the down arrow symbol. Note the tooltip that appears as illustrated in the screen shot

The mechanism is there but is clumsy

1 Like

I have tried it, but honestly I dont entirely understand my path through the surface. And where is it explained?
Ctrl + H is not a menu command.

  • I mark a section
  • Then I press Ctrl+H (the secret command)
  • Then I press the 'Find in Selection' Icon (Now I have been explained where it is)
  • Now I could press ''Replace All' (I have been brave to do this because 'All' is to me my entire file and not 'Selection') and - wow - it works!
  • But what command is Ctrl + H ? Does it have a name?

Anyway, thanks for the hint, I will aim to remember and use this.

However:

  • Why is this not part of the usual Search and Replace functionality?

Just as a feedback, intuitive is different. Where is this crtl+H feature offered, promoted, explained in the GUI?

It is a standard Windows shortcut, just like Ctrl+C, Ctrl+X and Ctrl+V, not a secret.

If you really want to get to the replace dialogue from the menu try Edit/Find to bring up the find dialogue then click the right pointing arrow icon to the left of the field where you enter the text to be found. Hover over it and you will see a tooltip

image

1 Like

I've used Arduino IDE 2.x and VS Code daily for the last 3.5 years and am very satisfied with the Search and Find capabilities. They are better than the equivalent features in any other editor or IDE I've worked with.

The IDE's keyboard shortcuts are listed and customizable via File > Advanced > Keyboard Shortcuts.

2 Likes

You can also use Ctrl+Shift+P to search through all (most) available commands. Searching for “Replace”, for example, yields the following results:

Ctrl+Shift+P is probably one of the commands I use most often.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.