From 270109a56b83f483f7a704c17c9f994a7e222503 Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Fri, 16 Jan 2026 23:15:23 +0100 Subject: [PATCH] Fix ctrl-shift-f and AddCommand bugs --- src/text_editor/commands.cpp | 6 ++++++ src/text_editor/plugin_search_open_buffers.cpp | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/text_editor/commands.cpp b/src/text_editor/commands.cpp index b6a2e57..a0b9907 100644 --- a/src/text_editor/commands.cpp +++ b/src/text_editor/commands.cpp @@ -536,6 +536,12 @@ void CMD_KillProcess() { } RegisterCommand(CMD_KillProcess, "", "Kill process in the last active primary window"); void AddCommand(Array *arr, String name, String binding, CMDFunction *function) { + IterRemove(*arr) { + IterRemovePrepare(*arr); + if (it.name == name) { + remove_item = true; + } + } Command cmd = {}; cmd.name = name; cmd.binding = binding; diff --git a/src/text_editor/plugin_search_open_buffers.cpp b/src/text_editor/plugin_search_open_buffers.cpp index eb560a2..ec8c746 100644 --- a/src/text_editor/plugin_search_open_buffers.cpp +++ b/src/text_editor/plugin_search_open_buffers.cpp @@ -91,9 +91,9 @@ void CMD_SearchOpenBuffers() { Open(string); }); view->update_hook = UpdateSearchOpenBuffersView; - SelectRange(view, GetLineRangeWithoutNL(search_project_buffer, 0)); if (string.len) { + SelectRange(view, GetLineRangeWithoutNL(search_project_buffer, 0)); Replace(view, string); - SelectEntireBuffer(view); } + SelectRange(view, GetLineRangeWithoutNL(search_project_buffer, 0)); } RegisterCommand(CMD_SearchOpenBuffers, "ctrl-shift-f", "Interactive search over the entire project in a new buffer view");