From e2ba8973230902612cb7388eb7b227d9a43a46ed Mon Sep 17 00:00:00 2001 From: pommicket Date: Sun, 28 Sep 2025 00:21:52 -0400 Subject: Don't autocomplete if there's a selection --- ide-autocomplete.c | 2 ++ main.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ide-autocomplete.c b/ide-autocomplete.c index 3ff138e..b469051 100644 --- a/ide-autocomplete.c +++ b/ide-autocomplete.c @@ -107,6 +107,7 @@ static bool autocomplete_should_display_phantom(Ted *ted) { // do the actual completion static void autocomplete_complete(Ted *ted, Autocompletion completion) { TextBuffer *buffer = ted->active_buffer; + if (buffer_has_selection(buffer)) return; buffer_start_edit_chain(buffer); // don't merge with other edits if (is32_word(buffer_char_before_cursor(buffer))) buffer_backspace_words_at_cursor(buffer, 1); // delete whatever text was already typed @@ -463,6 +464,7 @@ void autocomplete_open(Ted *ted, uint32_t trigger) { if (!buffer) return; if (!buffer_is_named_file(buffer)) return; if (buffer_is_view_only(buffer)) return; + if (buffer_has_selection(buffer)) return; autocomplete_clear_phantom(ac); const Settings *settings = buffer_settings(buffer); bool regenerated = false; diff --git a/main.c b/main.c index ca3aa69..9da5c2b 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,5 @@ /* TODO: -- don't autocomplete when tab is pressed if there is text selected - highlight correctly in Markdown - highlight (https://example.org) correctly in Markdown (exactly which characters are allowed in links?) - what did I mean by this -- cgit v1.2.3