Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions codex-rs/tui/src/bottom_pane/chat_composer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,11 @@ impl ChatComposer {
self.draft.textarea.cursor() + if self.draft.is_bash_mode { 1 } else { 0 }
}

#[cfg(test)]
pub(crate) fn cursor(&self) -> usize {
self.current_cursor()
}

fn history_navigation_cursor(&self) -> usize {
if self.draft.is_bash_mode && self.draft.textarea.cursor() == 0 {
0
Expand Down
6 changes: 6 additions & 0 deletions codex-rs/tui/src/bottom_pane/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ impl BottomPane {
local_image_paths,
mention_bindings,
);
self.composer.move_cursor_to_end();
self.request_redraw();
}

Expand Down Expand Up @@ -824,6 +825,11 @@ impl BottomPane {
self.composer.current_text()
}

#[cfg(test)]
pub(crate) fn composer_cursor(&self) -> usize {
self.composer.cursor()
}

pub(crate) fn composer_draft_snapshot(&self) -> chat_composer::ComposerDraftSnapshot {
self.composer.draft_snapshot()
}
Expand Down
1 change: 1 addition & 0 deletions codex-rs/tui/src/chatwidget/tests/composer_submission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ async fn queued_restore_with_remote_images_keeps_local_placeholder_mapping() {
});

assert_eq!(chat.bottom_pane.composer_text(), text);
assert_eq!(chat.bottom_pane.composer_cursor(), text.len());
assert_eq!(chat.bottom_pane.composer_text_elements(), text_elements);
assert_eq!(chat.bottom_pane.composer_local_images(), local_images);
assert_eq!(chat.remote_image_urls(), remote_image_urls);
Expand Down
Loading