From 8128c2932ea4c6d6259952e9430753fefc6e6661 Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Wed, 21 Jan 2026 08:59:32 +0100 Subject: [PATCH] Fix search anchor with ctrl-f --- src/text_editor/plugin_search_window.cpp | 2 +- src/text_editor/text_editor.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/text_editor/plugin_search_window.cpp b/src/text_editor/plugin_search_window.cpp index 0490ee2..704de44 100644 --- a/src/text_editor/plugin_search_window.cpp +++ b/src/text_editor/plugin_search_window.cpp @@ -1,6 +1,7 @@ void CMD_Search() { BSet main = GetBSet(ActiveWindowID); String16 string = {}; + main.window->search_bar_anchor = main.view->carets[0]; if (main.view->carets.len == 1 && GetSize(main.view->carets[0]) > 0) { string = GetString(main.buffer, main.view->carets[0].range); } @@ -19,7 +20,6 @@ void SearchWindowFindNext(bool forward = true) { BSet set = GetBSet(SearchWindowID); String16 seek = GetString(set.buffer, GetRange(set.buffer)); Find(main.view, seek, forward); - main.window->search_bar_anchor = main.view->carets[0]; CenterView(PrimaryWindowID); } diff --git a/src/text_editor/text_editor.h b/src/text_editor/text_editor.h index 01c0bcc..328fa07 100644 --- a/src/text_editor/text_editor.h +++ b/src/text_editor/text_editor.h @@ -142,7 +142,7 @@ struct Window { double mouse_scroller_offset; int z; double weight; - Caret search_bar_anchor; + Caret search_bar_anchor; // maybe move to view @todo GotoCrumb begin_frame_crumb; Array goto_history;