From 8481eb4c6e8bafee5cd86240566870df96246fa7 Mon Sep 17 00:00:00 2001 From: Jeremy Rose <172423086+nornagon-openai@users.noreply.github.com> Date: Wed, 20 Aug 2025 09:57:55 -0700 Subject: [PATCH] tui: tab-completing a command moves the cursor to the end (#2362) also tweak agents.md for faster `just fix` --- AGENTS.md | 2 +- codex-rs/justfile | 4 ++-- codex-rs/tui/src/bottom_pane/chat_composer.rs | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index f1744a87..eb2cacd5 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,7 +8,7 @@ In the codex-rs folder where the rust code lives: - You operate in a sandbox where `CODEX_SANDBOX_NETWORK_DISABLED=1` will be set whenever you use the `shell` tool. Any existing code that uses `CODEX_SANDBOX_NETWORK_DISABLED_ENV_VAR` was authored with this fact in mind. It is often used to early exit out of tests that the author knew you would not be able to run given your sandbox limitations. - Similarly, when you spawn a process using Seatbelt (`/usr/bin/sandbox-exec`), `CODEX_SANDBOX=seatbelt` will be set on the child process. Integration tests that want to run Seatbelt themselves cannot be run under Seatbelt, so checks for `CODEX_SANDBOX=seatbelt` are also often used to early exit out of tests, as appropriate. -Before finalizing a change to `codex-rs`, run `just fmt` (in `codex-rs` directory) to format the code and `just fix` (in `codex-rs` directory) to fix any linter issues in the code. Additionally, run the tests: +Before finalizing a change to `codex-rs`, run `just fmt` (in `codex-rs` directory) to format the code and `just fix -p ` (in `codex-rs` directory) to fix any linter issues in the code. Additionally, run the tests: 1. Run the test for the specific project that was changed. For example, if changes were made in `codex-rs/tui`, run `cargo test -p codex-tui`. 2. Once those pass, if any changes were made in common, core, or protocol, run the complete test suite with `cargo test --all-features`. diff --git a/codex-rs/justfile b/codex-rs/justfile index 3e1336be..beaa682d 100644 --- a/codex-rs/justfile +++ b/codex-rs/justfile @@ -24,8 +24,8 @@ file-search *args: fmt: cargo fmt -- --config imports_granularity=Item -fix: - cargo clippy --fix --all-features --tests --allow-dirty +fix *args: + cargo clippy --fix --all-features --tests --allow-dirty "$@" install: rustup show active-toolchain diff --git a/codex-rs/tui/src/bottom_pane/chat_composer.rs b/codex-rs/tui/src/bottom_pane/chat_composer.rs index 5d555aa0..29b03c89 100644 --- a/codex-rs/tui/src/bottom_pane/chat_composer.rs +++ b/codex-rs/tui/src/bottom_pane/chat_composer.rs @@ -275,6 +275,11 @@ impl ChatComposer { self.textarea.set_text(&format!("/{} ", cmd.command())); self.textarea.set_cursor(self.textarea.text().len()); } + // After completing the command, move cursor to the end. + if !self.textarea.text().is_empty() { + let end = self.textarea.text().len(); + self.textarea.set_cursor(end); + } } (InputResult::None, true) }