openhab-webui
openhab-webui copied to clipboard
Feature Request: Add Search and Replace Functionality to the Main UI Rule/Script Editor
The problem
It would be extremely helpful to have search and replace functionality in the Main UI’s rule and script editor. Currently, when working on larger DSL rules or UI-based scripts, making repetitive changes or locating specific variables or expressions requires manual scrolling and editing, which is time-consuming and error-prone.-
Requested Features: • Basic search (Ctrl+F) within the editor window. • Replace or replace-all functionality to make bulk edits quickly. • Optional: Regex support or case sensitivity toggle.
Use Case: Editing rules with repeated variable names, adjusting multiple states or command strings, or refactoring large blocks of code becomes significantly easier and faster with search/replace tools.
Your suggestion
Since the Main UI already uses CodeMirror, and CodeMirror includes official support for search and replace via its search and dialog addons, one possible enhancement path would be to enable these existing features in the current editor setup.
Your environment
openHAB 4.3.5 openhabian on Raspberry Pi 5 8Gb Ram
Additional information
Basic search (Ctrl+F) within the editor window.
This already exists, but it's provided by the browser.
The rest would be nice additions.
I don't know that the description is necessarily wrong here though. The browser provides find, but not replace. To get find and replace, that means transferring the find functionality from the browser to CodeMirror (or how ever that works).
My comment was just to point out that the whole "manual scrolling" part of the scenario outlined above isn't necessary now. Not to invalidate the whole issue.
Based on @rkoshak 's response, can we update the description?
Hi @stefan-hoen while i understand Rich’s comment is it fair to say that OH does not provide that search function. Which was the request.
Additionally if you try to use the browser based search it will highlight all items including items not in the editor (search for a number less than the number of lines in your widget, also if you do a paste [cmd-V on mac] all of the search is immediately de activated and you have to start the search again and so even the search does not work very well because it lacks any context
Example: https://codemirror.net/5/demo/search.html
If someone wants to implement it.. feel free to jump in. Otherwise, I can give it a go when I have some time.