From 8a980399c5f3941768b8e91e79e0b449d8eec8de Mon Sep 17 00:00:00 2001 From: pap-openai Date: Thu, 7 Aug 2025 00:58:06 +0100 Subject: [PATCH] fix cursor file name insert (#1896) Cursor wasn't moving when inserting a file, resulting in being not at the end of the filename when inserting the file. This fixes it by moving the cursor to the end of the file + one trailing space. Example screenshot after selecting a file when typing `@` image --- codex-rs/tui/src/bottom_pane/chat_composer.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codex-rs/tui/src/bottom_pane/chat_composer.rs b/codex-rs/tui/src/bottom_pane/chat_composer.rs index f30b980d..5d877253 100644 --- a/codex-rs/tui/src/bottom_pane/chat_composer.rs +++ b/codex-rs/tui/src/bottom_pane/chat_composer.rs @@ -453,6 +453,8 @@ impl ChatComposer { new_text.push_str(&text[end_idx..]); self.textarea.set_text(&new_text); + let new_cursor = start_idx.saturating_add(path.len()).saturating_add(1); + self.textarea.set_cursor(new_cursor); } /// Handle key event when no popup is visible.