fix(tui): keep popups above terminal images

This commit is contained in:
objz committed 2026-07-28 14:12:38 +02:00
1 parent 6e898b8c45
commit 992f15b082
4 files changed
+59 -23

No files matched your search

+1 -6
View File
@@ -100,13 +100,8 @@ fn terminal_image_cells_change_when_an_overlay_opens_or_closes() {
&[true, false, false]
));
assert!(!terminal_image_cells_changed(&[], &[true]));
}
#[test]
fn repainting_an_overlay_redraws_images_even_when_its_area_is_unchanged() {
assert!(terminal_images_need_redraw(
assert!(!terminal_image_cells_changed(
&[true, false, true],
&[true, false, true],
true,
));
}
+27
View File
@@ -0,0 +1,27 @@
use std::num::NonZeroU16;
use super::*;
#[test]
fn popup_cells_covering_terminal_images_are_always_redrawn() {
let area = Rect::new(0, 0, 4, 3);
let mut buffer = Buffer::empty(area);
buffer[(1, 1)].set_diff_option(CellDiffOption::Skip);
buffer[(2, 1)]
.set_symbol("\x1b_Gimage\x1b\\")
.set_diff_option(CellDiffOption::ForcedWidth(NonZeroU16::new(1).unwrap()));
let popup = PopupFrame {
title: Line::from("Popup"),
border_color: Color::White,
bg: Some(Color::Black),
keybinds: None,
search_line: None,
content: Box::new(|_, _| {}),
};
popup.render(area, &mut buffer);
assert_eq!(buffer[(1, 1)].diff_option, CellDiffOption::AlwaysUpdate);
assert_eq!(buffer[(2, 1)].diff_option, CellDiffOption::AlwaysUpdate);
assert_eq!(buffer[(0, 1)].diff_option, CellDiffOption::None);
}