mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Add local image thumbnails to the TUI composer (#58261)
## What changed - Show draft attachment thumbnails in reference order in inline and fullscreen views on supported terminals with local workspaces. Display a `+N` count for attachments that do not fit, and preserve editable image references when previews are unavailable or space is limited. - Refresh previews when attached files change, apply image orientation metadata, and clear frame graphics before terminal handoffs, screen switches, and shutdown. - Finish CLI subcommand dispatch before polling interactive TUI events. ## Testing Add a regression test and snapshot covering thumbnail order, overflow, resizing, attachment deletion, file replacement, and fallback behavior in both inline and fullscreen views. GitOrigin-RevId: 1ea7c89e089cecc390e145c1790b6ede8bad8d5e
This commit is contained in:
@@ -178,6 +178,7 @@ impl ChatWidget {
|
||||
backend_banner_notice_model: None,
|
||||
luna_reserve_notice_account_id: None,
|
||||
warning_display_state: WarningDisplayState::default(),
|
||||
composer_images: None,
|
||||
rendered_selection: Default::default(),
|
||||
rate_limit_switch_prompt: RateLimitSwitchPromptState::default(),
|
||||
add_credits_nudge_email_in_flight: None,
|
||||
|
||||
@@ -122,6 +122,20 @@ impl ExternalWriterNotice {
|
||||
}
|
||||
|
||||
impl ChatWidget {
|
||||
pub(crate) fn prepare_composer_images(&mut self, protocol: Option<crate::pets::ImageProtocol>) {
|
||||
self.composer_images = protocol
|
||||
.filter(|_| {
|
||||
!self.bottom_pane.composer_local_images().is_empty()
|
||||
&& self.no_modal_or_popup_active()
|
||||
})
|
||||
.and_then(|protocol| {
|
||||
crate::transcript_image::composer::ComposerImages::for_terminal(
|
||||
protocol,
|
||||
self.composer_images.take(),
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
pub(crate) fn as_renderable(&self) -> RenderableItem<'_> {
|
||||
let backdrop = self.as_backdrop_renderable();
|
||||
match self.centered_dialog() {
|
||||
@@ -270,6 +284,7 @@ impl ChatWidget {
|
||||
self.ambient_pet_wrap_reserved_cols()
|
||||
};
|
||||
options.rendered_selection = Some(&self.rendered_selection);
|
||||
options.image_previews = self.composer_images.as_ref();
|
||||
options.warning_count = self.warning_display_state.count;
|
||||
options.textarea_right_reserve = right_reserve;
|
||||
options.separate_status_line = options.command_popup_placement
|
||||
|
||||
Reference in New Issue
Block a user