Add a find/replace bar to the editor
Ctrl+F opens a find bar above the editor (Ctrl+H focuses the replace field; Edit ▸ Find / Replace… opens it too). Matches are shaded in the editor with the active one highlighted more strongly; Enter/Shift+Enter and ▼/▲ step through them with wraparound and scroll-to-view. An "Aa" toggle controls case sensitivity. Replace swaps the current match and advances; Replace all swaps every match in one pass. Esc closes the bar. Search/replace logic lives in pure, unit-tested functions (find_matches, replace_all) with non-overlapping matching and correct multibyte offset mapping for case-insensitive search. Highlighting reuses the editor's layout-job builder alongside the grammar underlines. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N9kRuP7JvXoUGdNNeg5ZSs
This commit is contained in:
+6
-2
@@ -64,12 +64,16 @@ fn cheatsheet_body(ui: &mut egui::Ui) {
|
||||
("Ctrl/Cmd + E", "Inline code (`…`)."),
|
||||
("Ctrl/Cmd + Shift + X", "Strikethrough (~~…~~)."),
|
||||
("Ctrl/Cmd + K", "Wrap as a link and select the url to replace."),
|
||||
("Ctrl/Cmd + F", "Open the find bar."),
|
||||
("Ctrl/Cmd + H", "Open find/replace (replace field focused)."),
|
||||
],
|
||||
);
|
||||
note(
|
||||
ui,
|
||||
"Applied to the selected text (or the caret, for an empty selection). \
|
||||
Pressing the same key on already-wrapped text removes the markers.",
|
||||
"Wrapping keys apply to the selected text (or the caret, for an empty \
|
||||
selection); pressing the same key on already-wrapped text removes the \
|
||||
markers. In the find bar, Enter / Shift+Enter step through matches and \
|
||||
Esc closes it.",
|
||||
);
|
||||
|
||||
section(ui, "Paragraphs & breaks");
|
||||
|
||||
Reference in New Issue
Block a user