mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
unify
This commit is contained in:
@@ -343,21 +343,6 @@ impl ChatComposer {
|
||||
self.collaboration_modes_enabled = enabled;
|
||||
}
|
||||
|
||||
pub(crate) fn set_popups_enabled(&mut self, enabled: bool) {
|
||||
self.popups_enabled = enabled;
|
||||
if !enabled {
|
||||
self.active_popup = ActivePopup::None;
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn set_footer_enabled(&mut self, enabled: bool) {
|
||||
self.footer_enabled = enabled;
|
||||
}
|
||||
|
||||
pub(crate) fn set_prompt_inset_enabled(&mut self, enabled: bool) {
|
||||
self.prompt_inset_enabled = enabled;
|
||||
}
|
||||
|
||||
pub(crate) fn desired_textarea_height(&self, width: u16) -> u16 {
|
||||
let cols_with_margin = if self.prompt_inset_enabled {
|
||||
LIVE_PREFIX_COLS + 3
|
||||
|
||||
@@ -56,9 +56,6 @@ impl NotesEntry {
|
||||
placeholder_text.to_string(),
|
||||
false,
|
||||
);
|
||||
composer.set_popups_enabled(false);
|
||||
composer.set_footer_enabled(false);
|
||||
composer.set_prompt_inset_enabled(false);
|
||||
composer.set_task_running(false);
|
||||
Self { composer }
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ use crate::bottom_pane::selection_popup_common::GenericDisplayRow;
|
||||
use crate::bottom_pane::selection_popup_common::render_rows;
|
||||
use crate::key_hint;
|
||||
use crate::render::renderable::Renderable;
|
||||
use crate::ui_consts::LIVE_PREFIX_COLS;
|
||||
|
||||
use super::RequestUserInputOverlay;
|
||||
|
||||
@@ -241,13 +242,14 @@ impl RequestUserInputOverlay {
|
||||
// Inline notes layout uses a prefix and a single-line text area.
|
||||
let prefix = notes_prefix();
|
||||
let prefix_width = prefix.len() as u16;
|
||||
if input_area.width <= prefix_width {
|
||||
let min_width = prefix_width.saturating_add(LIVE_PREFIX_COLS);
|
||||
if input_area.width <= min_width {
|
||||
return None;
|
||||
}
|
||||
let textarea_rect = Rect {
|
||||
x: input_area.x.saturating_add(prefix_width),
|
||||
x: input_area.x.saturating_add(min_width),
|
||||
y: input_area.y,
|
||||
width: input_area.width.saturating_sub(prefix_width),
|
||||
width: input_area.width.saturating_sub(min_width),
|
||||
height: 1,
|
||||
};
|
||||
return entry.composer.cursor_pos_textarea_only(textarea_rect);
|
||||
@@ -267,7 +269,8 @@ impl RequestUserInputOverlay {
|
||||
// Inline notes field for tight layouts.
|
||||
let prefix = notes_prefix();
|
||||
let prefix_width = prefix.len() as u16;
|
||||
if area.width <= prefix_width {
|
||||
let min_width = prefix_width.saturating_add(LIVE_PREFIX_COLS);
|
||||
if area.width <= min_width {
|
||||
Paragraph::new(Line::from(prefix.dim())).render(area, buf);
|
||||
return;
|
||||
}
|
||||
@@ -281,9 +284,9 @@ impl RequestUserInputOverlay {
|
||||
buf,
|
||||
);
|
||||
let textarea_rect = Rect {
|
||||
x: area.x.saturating_add(prefix_width),
|
||||
x: area.x.saturating_add(min_width),
|
||||
y: area.y,
|
||||
width: area.width.saturating_sub(prefix_width),
|
||||
width: area.width.saturating_sub(min_width),
|
||||
height: 1,
|
||||
};
|
||||
Clear.render(textarea_rect, buf);
|
||||
|
||||
Reference in New Issue
Block a user