aboutsummaryrefslogtreecommitdiff
path: root/src/client/shell/render.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/shell/render.rs')
-rw-r--r--src/client/shell/render.rs41
1 files changed, 30 insertions, 11 deletions
diff --git a/src/client/shell/render.rs b/src/client/shell/render.rs
index d51586a0..80387019 100644
--- a/src/client/shell/render.rs
+++ b/src/client/shell/render.rs
@@ -128,17 +128,36 @@ pub(super) fn render_mode_bar(
crate::api::schema::PaneCopySearchDirection::Forward => "/",
crate::api::schema::PaneCopySearchDirection::Backward => "?",
};
- segments.extend([
- (" COPY ".to_owned(), mode_style),
- (" ".to_owned(), base),
- (marker.to_owned(), key),
- (
- prompt.query.clone(),
- Style::default().fg(palette.text).bg(palette.panel_bg),
- ),
- ("█".to_owned(), key),
- (" enter search esc cancel".to_owned(), base),
- ]);
+ buffer.set_stringn(bar.x, bar.y, " COPY ", usize::from(bar.width), mode_style);
+ let prefix = 8.min(bar.width);
+ if bar.width >= 8 {
+ buffer.set_string(bar.x + 7, bar.y, marker, key);
+ }
+ let footer = " enter search esc cancel";
+ let footer_width = if bar.width >= 50 {
+ footer.len() as u16
+ } else {
+ 0
+ };
+ let field = Rect::new(
+ bar.x + prefix,
+ bar.y,
+ bar.width.saturating_sub(prefix + footer_width),
+ 1,
+ );
+ if let Some(cursor) = text_editor::render(
+ buffer,
+ field,
+ &prompt.query,
+ Style::default().fg(palette.text).bg(palette.panel_bg),
+ ) {
+ buffer[(cursor.x, cursor.y)]
+ .set_style(Style::default().fg(palette.panel_bg).bg(palette.text));
+ }
+ if footer_width > 0 {
+ buffer.set_string(bar.right() - footer_width, bar.y, footer, base);
+ }
+ return Some(bar);
} else {
let select = if copy_mode.selection.is_some() {
"selecting"