mirror of
https://github.com/openai/codex.git
synced 2026-11-28 07:32:19 +00:00
Extract focused TUI logic into submodules (#42397)
## What changed - Move `AgentsOverviewView` rendering and cursor placement into `agents_overview_render.rs`. - Extract paste-burst Enter handling from the main chat composer into the reconnect module while preserving the existing submission behavior. GitOrigin-RevId: 641daf9ad6cba79d805a9ae100f63ef81470757d
This commit is contained in:
1 parent
9bb1ea035f
commit
e6a944ad75
4 files changed
+234
-223
No files matched your search
@@ -3184,37 +3184,7 @@ impl ChatComposer {
|
||||
should_queue: bool,
|
||||
now: Instant,
|
||||
) -> (InputResult, bool) {
|
||||
// Preserve newlines that are part of a paste before applying parent-owned submission
|
||||
// policy. Queued startup input still flushes the burst into its queued message below.
|
||||
let in_slash_context = self.slash_commands_enabled()
|
||||
&& !self.draft.is_bash_mode
|
||||
&& (matches!(self.popups.active, ActivePopup::Command(_))
|
||||
|| self
|
||||
.draft
|
||||
.textarea
|
||||
.text()
|
||||
.lines()
|
||||
.next()
|
||||
.unwrap_or("")
|
||||
.starts_with('/'));
|
||||
if !should_queue
|
||||
&& !self.draft.disable_paste_burst
|
||||
&& self.draft.paste_burst.is_active()
|
||||
&& !in_slash_context
|
||||
&& self.draft.paste_burst.append_newline_if_active(now)
|
||||
{
|
||||
return (InputResult::None, true);
|
||||
}
|
||||
if !should_queue
|
||||
&& !in_slash_context
|
||||
&& !self.draft.disable_paste_burst
|
||||
&& self
|
||||
.draft
|
||||
.paste_burst
|
||||
.newline_should_insert_instead_of_submit(now)
|
||||
{
|
||||
self.draft.textarea.insert_str("\n");
|
||||
self.draft.paste_burst.extend_window(now);
|
||||
if !should_queue && self.handle_paste_enter(now) {
|
||||
return (InputResult::None, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,43 @@
|
||||
//! Offline editing bypasses command dispatch and popup actions, retaining the draft in place.
|
||||
//! Offline editing retains the draft, with shared paste Enter handling for submission.
|
||||
|
||||
use super::*;
|
||||
|
||||
impl ChatComposer {
|
||||
/// Preserve Enter inside a paste burst without attempting submission.
|
||||
pub(super) fn handle_paste_enter(&mut self, now: Instant) -> bool {
|
||||
let in_slash_context = self.slash_commands_enabled()
|
||||
&& !self.draft.is_bash_mode
|
||||
&& (matches!(self.popups.active, ActivePopup::Command(_))
|
||||
|| self
|
||||
.draft
|
||||
.textarea
|
||||
.text()
|
||||
.lines()
|
||||
.next()
|
||||
.unwrap_or("")
|
||||
.starts_with('/'));
|
||||
if !self.draft.disable_paste_burst
|
||||
&& self.draft.paste_burst.is_active()
|
||||
&& !in_slash_context
|
||||
&& self.draft.paste_burst.append_newline_if_active(now)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if !in_slash_context
|
||||
&& !self.draft.disable_paste_burst
|
||||
&& self
|
||||
.draft
|
||||
.paste_burst
|
||||
.newline_should_insert_instead_of_submit(now)
|
||||
{
|
||||
self.draft.textarea.insert_str("\n");
|
||||
self.draft.paste_burst.extend_window(now);
|
||||
return true;
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
pub(crate) fn handle_disconnected_key(&mut self, key: KeyEvent) {
|
||||
self.cancel_history_search();
|
||||
self.attachments.clear_remote_image_selection();
|
||||
|
||||
Reference in new issue
Block a user