diff --git a/src/text_editor/commands.cpp b/src/text_editor/commands.cpp index 884b88d..6450973 100644 --- a/src/text_editor/commands.cpp +++ b/src/text_editor/commands.cpp @@ -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; } diff --git a/src/text_editor/commands_window.cpp b/src/text_editor/commands_window.cpp index 5d89ce8..8b90b52 100644 --- a/src/text_editor/commands_window.cpp +++ b/src/text_editor/commands_window.cpp @@ -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); diff --git a/src/text_editor/text_editor.h b/src/text_editor/text_editor.h index 5cab8dc..54df980 100644 --- a/src/text_editor/text_editor.h +++ b/src/text_editor/text_editor.h @@ -95,4 +95,6 @@ void AfterEdit(View *view, Array edits); Scroller ComputeScrollerRect(Window *window); void Command_EvalLua(View *view, String16 string); void MergeCarets(View *view, Range *mouse_selection_anchor = NULL); -inline BufferID AllocBufferID(); \ No newline at end of file +inline BufferID AllocBufferID(); +void Command_SelectEntireBuffer(View *view); +void Command_Replace(View *view, String16 string); \ No newline at end of file