Fix search anchor with ctrl-f

This commit is contained in:
Krzosa Karol
2026-01-21 08:59:32 +01:00
parent 851eac0ec2
commit 8128c2932e
2 changed files with 2 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
void CMD_Search() { void CMD_Search() {
BSet main = GetBSet(ActiveWindowID); BSet main = GetBSet(ActiveWindowID);
String16 string = {}; String16 string = {};
main.window->search_bar_anchor = main.view->carets[0];
if (main.view->carets.len == 1 && GetSize(main.view->carets[0]) > 0) { if (main.view->carets.len == 1 && GetSize(main.view->carets[0]) > 0) {
string = GetString(main.buffer, main.view->carets[0].range); string = GetString(main.buffer, main.view->carets[0].range);
} }
@@ -19,7 +20,6 @@ void SearchWindowFindNext(bool forward = true) {
BSet set = GetBSet(SearchWindowID); BSet set = GetBSet(SearchWindowID);
String16 seek = GetString(set.buffer, GetRange(set.buffer)); String16 seek = GetString(set.buffer, GetRange(set.buffer));
Find(main.view, seek, forward); Find(main.view, seek, forward);
main.window->search_bar_anchor = main.view->carets[0];
CenterView(PrimaryWindowID); CenterView(PrimaryWindowID);
} }

View File

@@ -142,7 +142,7 @@ struct Window {
double mouse_scroller_offset; double mouse_scroller_offset;
int z; int z;
double weight; double weight;
Caret search_bar_anchor; Caret search_bar_anchor; // maybe move to view @todo
GotoCrumb begin_frame_crumb; GotoCrumb begin_frame_crumb;
Array<GotoCrumb> goto_history; Array<GotoCrumb> goto_history;