Improve search

This commit is contained in:
Krzosa Karol
2024-07-27 14:14:47 +02:00
parent 0ebe63eff3
commit 8b00f15710
3 changed files with 7 additions and 10 deletions

View File

@@ -309,6 +309,9 @@ bool GlobalCommand(Event event) {
SetActiveWindow(GetLastActiveWindow());
} else {
SetActiveWindow(search_window->id);
View *view = GetActiveView(search_window);
Command_SelectEntireBuffer(view);
Command_Replace(view, {});
}
run_window_command = false;
}

View File

@@ -237,14 +237,6 @@ void ReplaceInfobarData() {
ReplaceText(buffer, GetEndAsRange(*buffer), L"|");
}
// {
// Scratch scratch;
// uint64_t ms = SDL_GetTicks();
// double time = (double)ms / 1000.0;
// String string = Format(scratch, "%d %f %f", (int)FrameID, time, (time / (double)FrameID));
// DrawString(&MainFont, ToString16(scratch, string), {0, 0}, {255, 0, 0, 255});
// }
String s = Format(scratch, "line: %5lld col: %5lld name: %.*s wid: %d vid: %d bid: %d frame%lld", (long long)xy.line + 1ll, (long long)xy.col + 1ll, FmtString(name), (int)last_window->id.id, (int)last_view->id.id, (int)last_buffer->id.id, (long long)FrameID);
String16 string = ToString16(scratch, s);
ReplaceText(buffer, replace_range, string);
@@ -463,7 +455,7 @@ void WindowCommand(Event event, Window *window, View *view) {
}
if (Alt(SDLK_RETURN)) {
Command_SelectAll(seek_view, needle);
// SetActiveWindow(seek_window->id);
SetActiveWindow(seek_window->id);
} else if (Ctrl(SDLK_RETURN)) {
Caret caret = FindInBuffer(seek_buffer, needle, seek_view->carets[0], true);
Insert(&seek_view->carets, caret, 0);

View File

@@ -95,4 +95,6 @@ void AfterEdit(View *view, Array<Edit> edits);
Scroller ComputeScrollerRect(Window *window);
void Command_EvalLua(View *view, String16 string);
void MergeCarets(View *view, Range *mouse_selection_anchor = NULL);
inline BufferID AllocBufferID();
inline BufferID AllocBufferID();
void Command_SelectEntireBuffer(View *view);
void Command_Replace(View *view, String16 string);