From 5bc33adeb06871d11d32b49c0aa0a828ffb12715 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Fri, 27 Mar 2026 13:55:35 +0100 Subject: [PATCH] fix(tui): simplify behaviour of pasting clipboard to textbox Closes #107 --- EvoScientist/cli/tui_interactive.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/EvoScientist/cli/tui_interactive.py b/EvoScientist/cli/tui_interactive.py index 94bfb47..ca0fcee 100644 --- a/EvoScientist/cli/tui_interactive.py +++ b/EvoScientist/cli/tui_interactive.py @@ -1805,12 +1805,8 @@ def run_textual_interactive( return prompt = self.query_one("#prompt", ChatTextArea) - # Insert at cursor position - pos = prompt.cursor_position - current = prompt.value - new_value = current[:pos] + text + current[pos:] - prompt.value = new_value - prompt.cursor_position = pos + len(text) + prompt.insert(text) + prompt.focus() def action_tab_complete(self) -> None: """Handle TAB: cycle completions when visible, otherwise no-op. @@ -1874,8 +1870,6 @@ def run_textual_interactive( else: prompt.value = selected + " " - prompt.cursor_position = len(prompt.value) - def _hide_completions(self) -> None: self._comp_items = [] self._comp_index = -1