fix(logs): suppress debug logs when not debugging (#2532)

* fix(logs): suppress debug logs when not debugging

* fix(tests): add debug flag to constructor
This commit is contained in:
Aram Drevekenin 2023-06-13 14:55:49 +02:00 committed by GitHub
parent 603eeb4c58
commit 3d82a2f5ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 309 additions and 5 deletions

View file

@ -189,6 +189,7 @@ fn read_from_channel(
width: 8, width: 8,
}))); })));
let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default())); let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default()));
let debug = false;
let mut terminal_output = TerminalPane::new( let mut terminal_output = TerminalPane::new(
0, 0,
pane_geom, pane_geom,
@ -202,6 +203,7 @@ fn read_from_channel(
Rc::new(RefCell::new(HashMap::new())), Rc::new(RefCell::new(HashMap::new())),
None, None,
None, None,
debug,
); // 0 is the pane index ); // 0 is the pane index
loop { loop {
if !should_keep_running.load(Ordering::SeqCst) { if !should_keep_running.load(Ordering::SeqCst) {

View file

@ -749,12 +749,14 @@ fn init_session(
let max_panes = opts.max_panes; let max_panes = opts.max_panes;
let client_attributes_clone = client_attributes.clone(); let client_attributes_clone = client_attributes.clone();
let debug = opts.debug;
move || { move || {
screen_thread_main( screen_thread_main(
screen_bus, screen_bus,
max_panes, max_panes,
client_attributes_clone, client_attributes_clone,
config_options, config_options,
debug,
) )
.fatal(); .fatal();
} }

View file

@ -370,6 +370,7 @@ pub struct Grid {
pub focus_event_tracking: bool, pub focus_event_tracking: bool,
pub search_results: SearchResult, pub search_results: SearchResult,
pub pending_clipboard_update: Option<String>, pub pending_clipboard_update: Option<String>,
debug: bool,
} }
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
@ -457,6 +458,7 @@ impl Grid {
link_handler: Rc<RefCell<LinkHandler>>, link_handler: Rc<RefCell<LinkHandler>>,
character_cell_size: Rc<RefCell<Option<SizeInPixels>>>, character_cell_size: Rc<RefCell<Option<SizeInPixels>>>,
sixel_image_store: Rc<RefCell<SixelImageStore>>, sixel_image_store: Rc<RefCell<SixelImageStore>>,
debug: bool,
) -> Self { ) -> Self {
let sixel_grid = SixelGrid::new(character_cell_size.clone(), sixel_image_store); let sixel_grid = SixelGrid::new(character_cell_size.clone(), sixel_image_store);
Grid { Grid {
@ -505,6 +507,7 @@ impl Grid {
search_results: Default::default(), search_results: Default::default(),
sixel_grid, sixel_grid,
pending_clipboard_update: None, pending_clipboard_update: None,
debug,
} }
} }
pub fn render_full_viewport(&mut self) { pub fn render_full_viewport(&mut self) {
@ -2157,7 +2160,9 @@ impl Perform for Grid {
self.set_active_charset(CharsetIndex::G0); self.set_active_charset(CharsetIndex::G0);
}, },
_ => { _ => {
if self.debug {
log::warn!("Unhandled execute: {:?}", byte); log::warn!("Unhandled execute: {:?}", byte);
}
}, },
} }
} }
@ -2386,7 +2391,9 @@ impl Perform for Grid {
}, },
_ => { _ => {
if self.debug {
log::warn!("Unhandled osc: {:?}", params); log::warn!("Unhandled osc: {:?}", params);
}
}, },
} }
} }
@ -2912,9 +2919,11 @@ impl Perform for Grid {
_ => {}, _ => {},
} }
} else { } else {
if self.debug {
log::warn!("Unhandled csi: {}->{:?}", c, params); log::warn!("Unhandled csi: {}->{:?}", c, params);
} }
} }
}
fn esc_dispatch(&mut self, intermediates: &[u8], _ignore: bool, byte: u8) { fn esc_dispatch(&mut self, intermediates: &[u8], _ignore: bool, byte: u8) {
match (byte, intermediates.get(0)) { match (byte, intermediates.get(0)) {
@ -2994,7 +3003,9 @@ impl Perform for Grid {
self.fill_viewport(fill_character); self.fill_viewport(fill_character);
}, },
_ => { _ => {
if self.debug {
log::warn!("Unhandled esc_dispatch: {}->{:?}", byte, intermediates); log::warn!("Unhandled esc_dispatch: {}->{:?}", byte, intermediates);
}
}, },
} }
} }

View file

@ -39,6 +39,7 @@ macro_rules! get_or_create_grid {
$self.link_handler.clone(), $self.link_handler.clone(),
$self.character_cell_size.clone(), $self.character_cell_size.clone(),
$self.sixel_image_store.clone(), $self.sixel_image_store.clone(),
$self.debug,
); );
grid.hide_cursor(); grid.hide_cursor();
grid grid
@ -72,6 +73,7 @@ pub(crate) struct PluginPane {
pane_frame_color_override: Option<(PaletteColor, Option<String>)>, pane_frame_color_override: Option<(PaletteColor, Option<String>)>,
invoked_with: Option<Run>, invoked_with: Option<Run>,
loading_indication: LoadingIndication, loading_indication: LoadingIndication,
debug: bool,
} }
impl PluginPane { impl PluginPane {
@ -89,6 +91,7 @@ impl PluginPane {
currently_connected_clients: Vec<ClientId>, currently_connected_clients: Vec<ClientId>,
style: Style, style: Style,
invoked_with: Option<Run>, invoked_with: Option<Run>,
debug: bool,
) -> Self { ) -> Self {
let loading_indication = LoadingIndication::new(title.clone()).with_colors(style.colors); let loading_indication = LoadingIndication::new(title.clone()).with_colors(style.colors);
let initial_loading_message = loading_indication.to_string(); let initial_loading_message = loading_indication.to_string();
@ -118,6 +121,7 @@ impl PluginPane {
pane_frame_color_override: None, pane_frame_color_override: None,
invoked_with, invoked_with,
loading_indication, loading_indication,
debug,
}; };
for client_id in currently_connected_clients { for client_id in currently_connected_clients {
plugin.handle_plugin_bytes(client_id, initial_loading_message.as_bytes().to_vec()); plugin.handle_plugin_bytes(client_id, initial_loading_message.as_bytes().to_vec());

View file

@ -398,7 +398,6 @@ impl CharacterStyles {
*self = self.background(Some(AnsiCode::NamedColor(NamedColor::BrightWhite))) *self = self.background(Some(AnsiCode::NamedColor(NamedColor::BrightWhite)))
}, },
_ => { _ => {
log::warn!("unhandled csi m code {:?}", param);
return; return;
}, },
} }

View file

@ -737,6 +737,7 @@ impl TerminalPane {
terminal_emulator_color_codes: Rc<RefCell<HashMap<usize, String>>>, terminal_emulator_color_codes: Rc<RefCell<HashMap<usize, String>>>,
initial_pane_title: Option<String>, initial_pane_title: Option<String>,
invoked_with: Option<Run>, invoked_with: Option<Run>,
debug: bool,
) -> TerminalPane { ) -> TerminalPane {
let initial_pane_title = let initial_pane_title =
initial_pane_title.unwrap_or_else(|| format!("Pane #{}", pane_index)); initial_pane_title.unwrap_or_else(|| format!("Pane #{}", pane_index));
@ -748,6 +749,7 @@ impl TerminalPane {
link_handler, link_handler,
character_cell_size, character_cell_size,
sixel_image_store, sixel_image_store,
debug,
); );
TerminalPane { TerminalPane {
frame: HashMap::new(), frame: HashMap::new(),

File diff suppressed because it is too large Load diff

View file

@ -28,6 +28,7 @@ fn create_pane() -> TerminalPane {
let style = Style::default(); let style = Style::default();
let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default())); let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default()));
let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new())); let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new()));
let debug = false;
let mut terminal_pane = TerminalPane::new( let mut terminal_pane = TerminalPane::new(
pid, pid,
fake_win_size, fake_win_size,
@ -41,6 +42,7 @@ fn create_pane() -> TerminalPane {
terminal_emulator_color_codes, terminal_emulator_color_codes,
None, None,
None, None,
debug,
); // 0 is the pane index ); // 0 is the pane index
let content = read_fixture(); let content = read_fixture();
terminal_pane.handle_pty_bytes(content); terminal_pane.handle_pty_bytes(content);

View file

@ -36,6 +36,7 @@ pub fn scrolling_inside_a_pane() {
let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default())); let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default()));
let terminal_emulator_colors = Rc::new(RefCell::new(Palette::default())); let terminal_emulator_colors = Rc::new(RefCell::new(Palette::default()));
let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new())); let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new()));
let debug = false;
let mut terminal_pane = TerminalPane::new( let mut terminal_pane = TerminalPane::new(
pid, pid,
fake_win_size, fake_win_size,
@ -49,6 +50,7 @@ pub fn scrolling_inside_a_pane() {
terminal_emulator_color_codes, terminal_emulator_color_codes,
None, None,
None, None,
debug,
); // 0 is the pane index ); // 0 is the pane index
let mut text_to_fill_pane = String::new(); let mut text_to_fill_pane = String::new();
for i in 0..30 { for i in 0..30 {
@ -78,6 +80,7 @@ pub fn sixel_image_inside_terminal_pane() {
width: 8, width: 8,
height: 21, height: 21,
}))); })));
let debug = false;
let mut terminal_pane = TerminalPane::new( let mut terminal_pane = TerminalPane::new(
pid, pid,
fake_win_size, fake_win_size,
@ -91,6 +94,7 @@ pub fn sixel_image_inside_terminal_pane() {
terminal_emulator_color_codes, terminal_emulator_color_codes,
None, None,
None, None,
debug,
); // 0 is the pane index ); // 0 is the pane index
let sixel_image_bytes = "\u{1b}Pq let sixel_image_bytes = "\u{1b}Pq
#0;2;0;0;0#1;2;100;100;0#2;2;0;100;0 #0;2;0;0;0#1;2;100;100;0#2;2;0;100;0
@ -120,6 +124,7 @@ pub fn partial_sixel_image_inside_terminal_pane() {
width: 8, width: 8,
height: 21, height: 21,
}))); })));
let debug = false;
let mut terminal_pane = TerminalPane::new( let mut terminal_pane = TerminalPane::new(
pid, pid,
fake_win_size, fake_win_size,
@ -133,6 +138,7 @@ pub fn partial_sixel_image_inside_terminal_pane() {
terminal_emulator_color_codes, terminal_emulator_color_codes,
None, None,
None, None,
debug,
); // 0 is the pane index ); // 0 is the pane index
let pane_content = read_fixture("sixel-image-500px.six"); let pane_content = read_fixture("sixel-image-500px.six");
terminal_pane.handle_pty_bytes(pane_content); terminal_pane.handle_pty_bytes(pane_content);
@ -156,6 +162,7 @@ pub fn overflowing_sixel_image_inside_terminal_pane() {
width: 8, width: 8,
height: 21, height: 21,
}))); })));
let debug = false;
let mut terminal_pane = TerminalPane::new( let mut terminal_pane = TerminalPane::new(
pid, pid,
fake_win_size, fake_win_size,
@ -169,6 +176,7 @@ pub fn overflowing_sixel_image_inside_terminal_pane() {
terminal_emulator_color_codes, terminal_emulator_color_codes,
None, None,
None, None,
debug,
); // 0 is the pane index ); // 0 is the pane index
let pane_content = read_fixture("sixel-image-500px.six"); let pane_content = read_fixture("sixel-image-500px.six");
terminal_pane.handle_pty_bytes(pane_content); terminal_pane.handle_pty_bytes(pane_content);
@ -191,6 +199,7 @@ pub fn scrolling_through_a_sixel_image() {
width: 8, width: 8,
height: 21, height: 21,
}))); })));
let debug = false;
let mut terminal_pane = TerminalPane::new( let mut terminal_pane = TerminalPane::new(
pid, pid,
fake_win_size, fake_win_size,
@ -204,6 +213,7 @@ pub fn scrolling_through_a_sixel_image() {
terminal_emulator_color_codes, terminal_emulator_color_codes,
None, None,
None, None,
debug,
); // 0 is the pane index ); // 0 is the pane index
let mut text_to_fill_pane = String::new(); let mut text_to_fill_pane = String::new();
for i in 0..30 { for i in 0..30 {
@ -237,6 +247,7 @@ pub fn multiple_sixel_images_in_pane() {
width: 8, width: 8,
height: 21, height: 21,
}))); })));
let debug = false;
let mut terminal_pane = TerminalPane::new( let mut terminal_pane = TerminalPane::new(
pid, pid,
fake_win_size, fake_win_size,
@ -250,6 +261,7 @@ pub fn multiple_sixel_images_in_pane() {
terminal_emulator_color_codes, terminal_emulator_color_codes,
None, None,
None, None,
debug,
); // 0 is the pane index ); // 0 is the pane index
let mut text_to_fill_pane = String::new(); let mut text_to_fill_pane = String::new();
for i in 0..5 { for i in 0..5 {
@ -281,6 +293,7 @@ pub fn resizing_pane_with_sixel_images() {
width: 8, width: 8,
height: 21, height: 21,
}))); })));
let debug = false;
let mut terminal_pane = TerminalPane::new( let mut terminal_pane = TerminalPane::new(
pid, pid,
fake_win_size, fake_win_size,
@ -294,6 +307,7 @@ pub fn resizing_pane_with_sixel_images() {
terminal_emulator_color_codes, terminal_emulator_color_codes,
None, None,
None, None,
debug,
); // 0 is the pane index ); // 0 is the pane index
let mut text_to_fill_pane = String::new(); let mut text_to_fill_pane = String::new();
for i in 0..5 { for i in 0..5 {
@ -328,6 +342,7 @@ pub fn changing_character_cell_size_with_sixel_images() {
width: 8, width: 8,
height: 21, height: 21,
}))); })));
let debug = false;
let mut terminal_pane = TerminalPane::new( let mut terminal_pane = TerminalPane::new(
pid, pid,
fake_win_size, fake_win_size,
@ -341,6 +356,7 @@ pub fn changing_character_cell_size_with_sixel_images() {
terminal_emulator_color_codes, terminal_emulator_color_codes,
None, None,
None, None,
debug,
); // 0 is the pane index ); // 0 is the pane index
let mut text_to_fill_pane = String::new(); let mut text_to_fill_pane = String::new();
for i in 0..5 { for i in 0..5 {
@ -380,6 +396,7 @@ pub fn keep_working_after_corrupted_sixel_image() {
width: 8, width: 8,
height: 21, height: 21,
}))); })));
let debug = false;
let mut terminal_pane = TerminalPane::new( let mut terminal_pane = TerminalPane::new(
pid, pid,
fake_win_size, fake_win_size,
@ -393,6 +410,7 @@ pub fn keep_working_after_corrupted_sixel_image() {
terminal_emulator_color_codes, terminal_emulator_color_codes,
None, None,
None, None,
debug,
); // 0 is the pane index ); // 0 is the pane index
let sixel_image_bytes = "\u{1b}PI AM CORRUPTED BWAHAHAq let sixel_image_bytes = "\u{1b}PI AM CORRUPTED BWAHAHAq
@ -430,6 +448,7 @@ pub fn pane_with_frame_position_is_on_frame() {
width: 8, width: 8,
height: 21, height: 21,
}))); })));
let debug = false;
let mut terminal_pane = TerminalPane::new( let mut terminal_pane = TerminalPane::new(
pid, pid,
fake_win_size, fake_win_size,
@ -443,6 +462,7 @@ pub fn pane_with_frame_position_is_on_frame() {
terminal_emulator_color_codes, terminal_emulator_color_codes,
None, None,
None, None,
debug,
); // 0 is the pane index ); // 0 is the pane index
terminal_pane.set_content_offset(Offset::frame(1)); terminal_pane.set_content_offset(Offset::frame(1));
@ -516,6 +536,7 @@ pub fn pane_with_bottom_and_right_borders_position_is_on_frame() {
width: 8, width: 8,
height: 21, height: 21,
}))); })));
let debug = false;
let mut terminal_pane = TerminalPane::new( let mut terminal_pane = TerminalPane::new(
pid, pid,
fake_win_size, fake_win_size,
@ -529,6 +550,7 @@ pub fn pane_with_bottom_and_right_borders_position_is_on_frame() {
terminal_emulator_color_codes, terminal_emulator_color_codes,
None, None,
None, None,
debug,
); // 0 is the pane index ); // 0 is the pane index
terminal_pane.set_content_offset(Offset::shift(1, 1)); terminal_pane.set_content_offset(Offset::shift(1, 1));
@ -602,6 +624,7 @@ pub fn frameless_pane_position_is_on_frame() {
width: 8, width: 8,
height: 21, height: 21,
}))); })));
let debug = false;
let mut terminal_pane = TerminalPane::new( let mut terminal_pane = TerminalPane::new(
pid, pid,
fake_win_size, fake_win_size,
@ -615,6 +638,7 @@ pub fn frameless_pane_position_is_on_frame() {
terminal_emulator_color_codes, terminal_emulator_color_codes,
None, None,
None, None,
debug,
); // 0 is the pane index ); // 0 is the pane index
terminal_pane.set_content_offset(Offset::default()); terminal_pane.set_content_offset(Offset::default());

View file

@ -502,6 +502,7 @@ pub(crate) struct Screen {
auto_layout: bool, auto_layout: bool,
session_is_mirrored: bool, session_is_mirrored: bool,
copy_options: CopyOptions, copy_options: CopyOptions,
debug: bool,
} }
impl Screen { impl Screen {
@ -515,6 +516,7 @@ impl Screen {
auto_layout: bool, auto_layout: bool,
session_is_mirrored: bool, session_is_mirrored: bool,
copy_options: CopyOptions, copy_options: CopyOptions,
debug: bool,
) -> Self { ) -> Self {
Screen { Screen {
bus, bus,
@ -537,6 +539,7 @@ impl Screen {
auto_layout, auto_layout,
session_is_mirrored, session_is_mirrored,
copy_options, copy_options,
debug,
} }
} }
@ -1055,6 +1058,7 @@ impl Screen {
self.terminal_emulator_colors.clone(), self.terminal_emulator_colors.clone(),
self.terminal_emulator_color_codes.clone(), self.terminal_emulator_color_codes.clone(),
swap_layouts, swap_layouts,
self.debug,
); );
self.tabs.insert(tab_index, tab); self.tabs.insert(tab_index, tab);
Ok(()) Ok(())
@ -1510,6 +1514,7 @@ pub(crate) fn screen_thread_main(
max_panes: Option<usize>, max_panes: Option<usize>,
client_attributes: ClientAttributes, client_attributes: ClientAttributes,
config_options: Box<Options>, config_options: Box<Options>,
debug: bool,
) -> Result<()> { ) -> Result<()> {
let capabilities = config_options.simplified_ui; let capabilities = config_options.simplified_ui;
let draw_pane_frames = config_options.pane_frames.unwrap_or(true); let draw_pane_frames = config_options.pane_frames.unwrap_or(true);
@ -1536,6 +1541,7 @@ pub(crate) fn screen_thread_main(
auto_layout, auto_layout,
session_is_mirrored, session_is_mirrored,
copy_options, copy_options,
debug,
); );
let mut pending_tab_ids: HashSet<usize> = HashSet::new(); let mut pending_tab_ids: HashSet<usize> = HashSet::new();

View file

@ -38,6 +38,7 @@ pub struct LayoutApplier<'a> {
draw_pane_frames: bool, draw_pane_frames: bool,
focus_pane_id: &'a mut Option<PaneId>, focus_pane_id: &'a mut Option<PaneId>,
os_api: Box<dyn ServerOsApi>, os_api: Box<dyn ServerOsApi>,
debug: bool,
} }
impl<'a> LayoutApplier<'a> { impl<'a> LayoutApplier<'a> {
@ -57,6 +58,7 @@ impl<'a> LayoutApplier<'a> {
draw_pane_frames: bool, draw_pane_frames: bool,
focus_pane_id: &'a mut Option<PaneId>, focus_pane_id: &'a mut Option<PaneId>,
os_api: &Box<dyn ServerOsApi>, os_api: &Box<dyn ServerOsApi>,
debug: bool,
) -> Self { ) -> Self {
let viewport = viewport.clone(); let viewport = viewport.clone();
let senders = senders.clone(); let senders = senders.clone();
@ -85,6 +87,7 @@ impl<'a> LayoutApplier<'a> {
draw_pane_frames, draw_pane_frames,
focus_pane_id, focus_pane_id,
os_api, os_api,
debug,
} }
} }
pub fn apply_layout( pub fn apply_layout(
@ -233,6 +236,7 @@ impl<'a> LayoutApplier<'a> {
self.connected_clients.borrow().iter().copied().collect(), self.connected_clients.borrow().iter().copied().collect(),
self.style, self.style,
layout.run.clone(), layout.run.clone(),
self.debug,
); );
new_plugin.set_borderless(layout.borderless); new_plugin.set_borderless(layout.borderless);
if let Some(exclude_from_sync) = layout.exclude_from_sync { if let Some(exclude_from_sync) = layout.exclude_from_sync {
@ -263,6 +267,7 @@ impl<'a> LayoutApplier<'a> {
self.terminal_emulator_color_codes.clone(), self.terminal_emulator_color_codes.clone(),
initial_title, initial_title,
layout.run.clone(), layout.run.clone(),
self.debug,
); );
new_pane.set_borderless(layout.borderless); new_pane.set_borderless(layout.borderless);
if let Some(exclude_from_sync) = layout.exclude_from_sync { if let Some(exclude_from_sync) = layout.exclude_from_sync {
@ -342,6 +347,7 @@ impl<'a> LayoutApplier<'a> {
self.connected_clients.borrow().iter().copied().collect(), self.connected_clients.borrow().iter().copied().collect(),
self.style, self.style,
floating_pane_layout.run.clone(), floating_pane_layout.run.clone(),
self.debug,
); );
new_pane.set_borderless(false); new_pane.set_borderless(false);
new_pane.set_content_offset(Offset::frame(1)); new_pane.set_content_offset(Offset::frame(1));
@ -379,6 +385,7 @@ impl<'a> LayoutApplier<'a> {
self.terminal_emulator_color_codes.clone(), self.terminal_emulator_color_codes.clone(),
initial_title, initial_title,
floating_pane_layout.run.clone(), floating_pane_layout.run.clone(),
self.debug,
); );
new_pane.set_borderless(false); new_pane.set_borderless(false);
new_pane.set_content_offset(Offset::frame(1)); new_pane.set_content_offset(Offset::frame(1));

View file

@ -170,6 +170,7 @@ pub(crate) struct Tab {
pending_instructions: Vec<BufferedTabInstruction>, // instructions that came while the tab was pending_instructions: Vec<BufferedTabInstruction>, // instructions that came while the tab was
// pending and need to be re-applied // pending and need to be re-applied
swap_layouts: SwapLayouts, swap_layouts: SwapLayouts,
debug: bool,
} }
#[derive(Clone, Debug, Default, Serialize, Deserialize)] #[derive(Clone, Debug, Default, Serialize, Deserialize)]
@ -498,6 +499,7 @@ impl Tab {
terminal_emulator_colors: Rc<RefCell<Palette>>, terminal_emulator_colors: Rc<RefCell<Palette>>,
terminal_emulator_color_codes: Rc<RefCell<HashMap<usize, String>>>, terminal_emulator_color_codes: Rc<RefCell<HashMap<usize, String>>>,
swap_layouts: (Vec<SwapTiledLayout>, Vec<SwapFloatingLayout>), swap_layouts: (Vec<SwapTiledLayout>, Vec<SwapFloatingLayout>),
debug: bool,
) -> Self { ) -> Self {
let name = if name.is_empty() { let name = if name.is_empty() {
format!("Tab #{}", index + 1) format!("Tab #{}", index + 1)
@ -584,6 +586,7 @@ impl Tab {
is_pending: true, // will be switched to false once the layout is applied is_pending: true, // will be switched to false once the layout is applied
pending_instructions: vec![], pending_instructions: vec![],
swap_layouts, swap_layouts,
debug,
} }
} }
@ -614,6 +617,7 @@ impl Tab {
self.draw_pane_frames, self.draw_pane_frames,
&mut self.focus_pane_id, &mut self.focus_pane_id,
&self.os_api, &self.os_api,
self.debug,
) )
.apply_layout( .apply_layout(
layout, layout,
@ -673,6 +677,7 @@ impl Tab {
self.draw_pane_frames, self.draw_pane_frames,
&mut self.focus_pane_id, &mut self.focus_pane_id,
&self.os_api, &self.os_api,
self.debug,
) )
.apply_floating_panes_layout_to_existing_panes( .apply_floating_panes_layout_to_existing_panes(
&layout_candidate, &layout_candidate,
@ -726,6 +731,7 @@ impl Tab {
self.draw_pane_frames, self.draw_pane_frames,
&mut self.focus_pane_id, &mut self.focus_pane_id,
&self.os_api, &self.os_api,
self.debug,
) )
.apply_tiled_panes_layout_to_existing_panes( .apply_tiled_panes_layout_to_existing_panes(
&layout_candidate, &layout_candidate,
@ -1013,6 +1019,7 @@ impl Tab {
self.terminal_emulator_color_codes.clone(), self.terminal_emulator_color_codes.clone(),
initial_pane_title, initial_pane_title,
None, None,
self.debug,
)) as Box<dyn Pane> )) as Box<dyn Pane>
}, },
PaneId::Plugin(plugin_pid) => { PaneId::Plugin(plugin_pid) => {
@ -1034,6 +1041,7 @@ impl Tab {
self.connected_clients.borrow().iter().copied().collect(), self.connected_clients.borrow().iter().copied().collect(),
self.style, self.style,
run_plugin, run_plugin,
self.debug,
)) as Box<dyn Pane> )) as Box<dyn Pane>
}, },
}; };
@ -1065,6 +1073,7 @@ impl Tab {
self.terminal_emulator_color_codes.clone(), self.terminal_emulator_color_codes.clone(),
None, None,
None, None,
self.debug,
); );
new_pane.update_name("EDITING SCROLLBACK"); // we do this here and not in the new_pane.update_name("EDITING SCROLLBACK"); // we do this here and not in the
// constructor so it won't be overrided // constructor so it won't be overrided
@ -1140,6 +1149,7 @@ impl Tab {
self.terminal_emulator_color_codes.clone(), self.terminal_emulator_color_codes.clone(),
initial_pane_title, initial_pane_title,
None, None,
self.debug,
); );
self.tiled_panes self.tiled_panes
.split_pane_horizontally(pid, Box::new(new_terminal), client_id); .split_pane_horizontally(pid, Box::new(new_terminal), client_id);
@ -1196,6 +1206,7 @@ impl Tab {
self.terminal_emulator_color_codes.clone(), self.terminal_emulator_color_codes.clone(),
initial_pane_title, initial_pane_title,
None, None,
self.debug,
); );
self.tiled_panes self.tiled_panes
.split_pane_vertically(pid, Box::new(new_terminal), client_id); .split_pane_vertically(pid, Box::new(new_terminal), client_id);

View file

@ -222,6 +222,7 @@ fn create_new_tab(size: Size, default_mode: ModeInfo) -> Tab {
let copy_options = CopyOptions::default(); let copy_options = CopyOptions::default();
let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new())); let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new()));
let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default())); let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default()));
let debug = false;
let mut tab = Tab::new( let mut tab = Tab::new(
index, index,
position, position,
@ -243,6 +244,7 @@ fn create_new_tab(size: Size, default_mode: ModeInfo) -> Tab {
terminal_emulator_colors, terminal_emulator_colors,
terminal_emulator_color_codes, terminal_emulator_color_codes,
(vec![], vec![]), (vec![], vec![]),
debug,
); );
tab.apply_layout( tab.apply_layout(
TiledPaneLayout::default(), TiledPaneLayout::default(),
@ -292,6 +294,7 @@ fn create_new_tab_with_swap_layouts(
let copy_options = CopyOptions::default(); let copy_options = CopyOptions::default();
let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new())); let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new()));
let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default())); let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default()));
let debug = false;
let mut tab = Tab::new( let mut tab = Tab::new(
index, index,
position, position,
@ -313,6 +316,7 @@ fn create_new_tab_with_swap_layouts(
terminal_emulator_colors, terminal_emulator_colors,
terminal_emulator_color_codes, terminal_emulator_color_codes,
swap_layouts, swap_layouts,
debug,
); );
let ( let (
base_layout, base_layout,
@ -364,6 +368,7 @@ fn create_new_tab_with_os_api(
let copy_options = CopyOptions::default(); let copy_options = CopyOptions::default();
let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new())); let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new()));
let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default())); let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default()));
let debug = false;
let mut tab = Tab::new( let mut tab = Tab::new(
index, index,
position, position,
@ -385,6 +390,7 @@ fn create_new_tab_with_os_api(
terminal_emulator_colors, terminal_emulator_colors,
terminal_emulator_color_codes, terminal_emulator_color_codes,
(vec![], vec![]), // swap layouts (vec![], vec![]), // swap layouts
debug,
); );
tab.apply_layout( tab.apply_layout(
TiledPaneLayout::default(), TiledPaneLayout::default(),
@ -422,6 +428,7 @@ fn create_new_tab_with_layout(size: Size, default_mode: ModeInfo, layout: &str)
let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default())); let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default()));
let layout = Layout::from_str(layout, "layout_file_name".into(), None, None).unwrap(); let layout = Layout::from_str(layout, "layout_file_name".into(), None, None).unwrap();
let (tab_layout, floating_panes_layout) = layout.new_tab(); let (tab_layout, floating_panes_layout) = layout.new_tab();
let debug = false;
let mut tab = Tab::new( let mut tab = Tab::new(
index, index,
position, position,
@ -443,6 +450,7 @@ fn create_new_tab_with_layout(size: Size, default_mode: ModeInfo, layout: &str)
terminal_emulator_colors, terminal_emulator_colors,
terminal_emulator_color_codes, terminal_emulator_color_codes,
(vec![], vec![]), // swap layouts (vec![], vec![]), // swap layouts
debug,
); );
let pane_ids = tab_layout let pane_ids = tab_layout
.extract_run_instructions() .extract_run_instructions()
@ -494,6 +502,7 @@ fn create_new_tab_with_mock_pty_writer(
let copy_options = CopyOptions::default(); let copy_options = CopyOptions::default();
let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new())); let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new()));
let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default())); let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default()));
let debug = false;
let mut tab = Tab::new( let mut tab = Tab::new(
index, index,
position, position,
@ -515,6 +524,7 @@ fn create_new_tab_with_mock_pty_writer(
terminal_emulator_colors, terminal_emulator_colors,
terminal_emulator_color_codes, terminal_emulator_color_codes,
(vec![], vec![]), // swap layouts (vec![], vec![]), // swap layouts
debug,
); );
tab.apply_layout( tab.apply_layout(
TiledPaneLayout::default(), TiledPaneLayout::default(),
@ -557,6 +567,7 @@ fn create_new_tab_with_sixel_support(
let terminal_emulator_colors = Rc::new(RefCell::new(Palette::default())); let terminal_emulator_colors = Rc::new(RefCell::new(Palette::default()));
let copy_options = CopyOptions::default(); let copy_options = CopyOptions::default();
let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new())); let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new()));
let debug = false;
let mut tab = Tab::new( let mut tab = Tab::new(
index, index,
position, position,
@ -578,6 +589,7 @@ fn create_new_tab_with_sixel_support(
terminal_emulator_colors, terminal_emulator_colors,
terminal_emulator_color_codes, terminal_emulator_color_codes,
(vec![], vec![]), // swap layouts (vec![], vec![]), // swap layouts
debug,
); );
tab.apply_layout( tab.apply_layout(
TiledPaneLayout::default(), TiledPaneLayout::default(),
@ -613,6 +625,7 @@ fn take_snapshot(ansi_instructions: &str, rows: usize, columns: usize, palette:
width: 8, width: 8,
height: 21, height: 21,
}))); })));
let debug = false;
let mut grid = Grid::new( let mut grid = Grid::new(
rows, rows,
columns, columns,
@ -621,6 +634,7 @@ fn take_snapshot(ansi_instructions: &str, rows: usize, columns: usize, palette:
Rc::new(RefCell::new(LinkHandler::new())), Rc::new(RefCell::new(LinkHandler::new())),
character_cell_size, character_cell_size,
sixel_image_store, sixel_image_store,
debug,
); );
let mut vte_parser = vte::Parser::new(); let mut vte_parser = vte::Parser::new();
for &byte in ansi_instructions.as_bytes() { for &byte in ansi_instructions.as_bytes() {
@ -641,6 +655,7 @@ fn take_snapshot_with_sixel(
width: 8, width: 8,
height: 21, height: 21,
}))); })));
let debug = false;
let mut grid = Grid::new( let mut grid = Grid::new(
rows, rows,
columns, columns,
@ -649,6 +664,7 @@ fn take_snapshot_with_sixel(
Rc::new(RefCell::new(LinkHandler::new())), Rc::new(RefCell::new(LinkHandler::new())),
character_cell_size, character_cell_size,
sixel_image_store, sixel_image_store,
debug,
); );
let mut vte_parser = vte::Parser::new(); let mut vte_parser = vte::Parser::new();
for &byte in ansi_instructions.as_bytes() { for &byte in ansi_instructions.as_bytes() {
@ -666,6 +682,7 @@ fn take_snapshot_and_cursor_position(
// snapshot, x_coordinates, y_coordinates // snapshot, x_coordinates, y_coordinates
let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default())); let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default()));
let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new())); let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new()));
let debug = false;
let mut grid = Grid::new( let mut grid = Grid::new(
rows, rows,
columns, columns,
@ -674,6 +691,7 @@ fn take_snapshot_and_cursor_position(
Rc::new(RefCell::new(LinkHandler::new())), Rc::new(RefCell::new(LinkHandler::new())),
Rc::new(RefCell::new(None)), Rc::new(RefCell::new(None)),
sixel_image_store, sixel_image_store,
debug,
); );
let mut vte_parser = vte::Parser::new(); let mut vte_parser = vte::Parser::new();
for &byte in ansi_instructions.as_bytes() { for &byte in ansi_instructions.as_bytes() {

View file

@ -164,6 +164,7 @@ fn create_new_tab(size: Size) -> Tab {
let copy_options = CopyOptions::default(); let copy_options = CopyOptions::default();
let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default())); let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default()));
let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new())); let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new()));
let debug = false;
let mut tab = Tab::new( let mut tab = Tab::new(
index, index,
position, position,
@ -185,6 +186,7 @@ fn create_new_tab(size: Size) -> Tab {
terminal_emulator_colors, terminal_emulator_colors,
terminal_emulator_color_codes, terminal_emulator_color_codes,
(vec![], vec![]), // swap layouts (vec![], vec![]), // swap layouts
debug,
); );
tab.apply_layout( tab.apply_layout(
TiledPaneLayout::default(), TiledPaneLayout::default(),
@ -219,6 +221,7 @@ fn create_new_tab_with_layout(size: Size, layout: TiledPaneLayout) -> Tab {
let copy_options = CopyOptions::default(); let copy_options = CopyOptions::default();
let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default())); let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default()));
let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new())); let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new()));
let debug = false;
let mut tab = Tab::new( let mut tab = Tab::new(
index, index,
position, position,
@ -240,6 +243,7 @@ fn create_new_tab_with_layout(size: Size, layout: TiledPaneLayout) -> Tab {
terminal_emulator_colors, terminal_emulator_colors,
terminal_emulator_color_codes, terminal_emulator_color_codes,
(vec![], vec![]), // swap layouts (vec![], vec![]), // swap layouts
debug,
); );
let mut new_terminal_ids = vec![]; let mut new_terminal_ids = vec![];
for i in 0..layout.extract_run_instructions().len() { for i in 0..layout.extract_run_instructions().len() {
@ -280,6 +284,7 @@ fn create_new_tab_with_cell_size(
let copy_options = CopyOptions::default(); let copy_options = CopyOptions::default();
let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default())); let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default()));
let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new())); let terminal_emulator_color_codes = Rc::new(RefCell::new(HashMap::new()));
let debug = false;
let mut tab = Tab::new( let mut tab = Tab::new(
index, index,
position, position,
@ -301,6 +306,7 @@ fn create_new_tab_with_cell_size(
terminal_emulator_colors, terminal_emulator_colors,
terminal_emulator_color_codes, terminal_emulator_color_codes,
(vec![], vec![]), // swap layouts (vec![], vec![]), // swap layouts
debug,
); );
tab.apply_layout( tab.apply_layout(
TiledPaneLayout::default(), TiledPaneLayout::default(),

View file

@ -66,6 +66,7 @@ fn take_snapshots_and_cursor_coordinates_from_render_events<'a>(
width: 8, width: 8,
height: 21, height: 21,
}))); })));
let debug = false;
let mut grid = Grid::new( let mut grid = Grid::new(
screen_size.rows, screen_size.rows,
screen_size.cols, screen_size.cols,
@ -74,6 +75,7 @@ fn take_snapshots_and_cursor_coordinates_from_render_events<'a>(
Rc::new(RefCell::new(LinkHandler::new())), Rc::new(RefCell::new(LinkHandler::new())),
character_cell_size, character_cell_size,
sixel_image_store, sixel_image_store,
debug,
); );
let snapshots: Vec<(Option<(usize, usize)>, String)> = all_events let snapshots: Vec<(Option<(usize, usize)>, String)> = all_events
.filter_map(|server_instruction| { .filter_map(|server_instruction| {
@ -232,6 +234,7 @@ fn create_new_screen(size: Size) -> Screen {
let session_is_mirrored = true; let session_is_mirrored = true;
let copy_options = CopyOptions::default(); let copy_options = CopyOptions::default();
let debug = false;
let screen = Screen::new( let screen = Screen::new(
bus, bus,
&client_attributes, &client_attributes,
@ -241,6 +244,7 @@ fn create_new_screen(size: Size) -> Screen {
auto_layout, auto_layout,
session_is_mirrored, session_is_mirrored,
copy_options, copy_options,
debug,
); );
screen screen
} }
@ -281,6 +285,7 @@ impl MockScreen {
Some(Box::new(self.os_input.clone())), Some(Box::new(self.os_input.clone())),
) )
.should_silently_fail(); .should_silently_fail();
let debug = false;
let screen_thread = std::thread::Builder::new() let screen_thread = std::thread::Builder::new()
.name("screen_thread".to_string()) .name("screen_thread".to_string())
.spawn(move || { .spawn(move || {
@ -290,6 +295,7 @@ impl MockScreen {
None, None,
client_attributes, client_attributes,
Box::new(config_options), Box::new(config_options),
debug,
) )
.expect("TEST") .expect("TEST")
}) })