GoAlexander / harbour-editor

Functional rich editor for Sailfish OS.
GNU General Public License v3.0
17 stars 16 forks source link

[Feature suggestion] Extend Search to Search & Replace #85

Open Olf0 opened 7 years ago

Olf0 commented 7 years ago

Extend Editor.'s search bar with a second line, containing a "R" button or an upward arrow hitting a line (like one of the two rightmost buttons in the search field line rotated by 90 degrees; maybe with a circle around it, if such a symbol is at hand and space is sufficient) below the magnifying lens icon of the first line, followed by a text field for the replacement string, a "(X)" button (if text was entered in the text field, as in the search line) and an "Insert" button.

[Extra suggestion] Detect landscape orientation and place both (the search and the replacement) lines side by side (i.e. in a single line), then.

Edit: [Extend this functionality, optionally] Add a "R all" button (with the "R" set in italic; see comment below for details) left of the "Insert" button (i.e. as the second button from the right in this line) to enable users replacing all occurrences of the search term in the document with the replacement string. Note that a "Replace all" functionality would be more convenient and safer to use when the feature suggestion of issue #90 is implemented.

P.S.: I am aware, that this feature suggestion duplicates SailfishOS's clipboard functionality to a certain extent, but it would provide the classic search&replace functionality conveniently.

GoAlexander commented 7 years ago

Hm, I like it. Will try implement in the feature but the priority will be low by now. High priority: Dropbox, UI 2.0, RegExpressions, background fix, highlighting improvements, lineNumbers fix

ghost commented 7 years ago

Very nice Search and Replace.

Olf0 commented 7 years ago

@GoAlexander: I considered this rather easy to implement. Most UI elements are already there (in the search line) and the "Insert" button just has to emit the string from the input field. Edit: Only the (freshly added in the original message) "Replace all" function appears to be a bit harder. Hence you may want to look at that sub-feature separately and later.

Olf0 commented 7 years ago

Extend Editor.'s search bar with a second line, containing a "R" button or an upward arrow hitting a line (like one of the two rightmost buttons in the search field line rotated by 90 degrees; maybe with a circle around it, if such a symbol is at hand and space is sufficient) below the magnifying lens icon of the first line, [...]

I guess a bold, capital R (for "Replace"; you may try to set it italic additionally, but that R might look worse than solely set bold R) is the best and easiest symbol left of the text field to denote the function of the second line.

Edit: When considering the "Replace all" function, it may make sense, look good and create a connection of the "R"s to "Replace", if both "R"s are set in italic: R (bold & italic) at the beginning of the line and "R all" (the R being set italic, only) as the button label.

Edit 2: And in consequence the pulley menu entry (or wherever it is moved to in Editor.'s UI 2.0) may be labelled "Search & R", which avoids the lengthy word "Replace" or abbreviations of it, which are all somewhat clumsy, e.g. "R.", "Repl." (could mean "Reply" or "Replicate" as well), "Repla." (well, not much gained) etc.