From 68c36be2e26813a2a3d7210ae82824de06b3d3ee Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 8 Mar 2023 23:43:23 -0500 Subject: implement callback for terminal resize request --- src/state.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/state.rs') diff --git a/src/state.rs b/src/state.rs index c84fa2b..5471bdd 100644 --- a/src/state.rs +++ b/src/state.rs @@ -42,6 +42,20 @@ impl<'a, T: crate::callbacks::Callbacks> vte::Perform for State<'a, T> { ignore: bool, c: char, ) { + if intermediates.first().is_none() && c == 't' { + let mut iter = params.iter(); + let op = iter.next().and_then(|x| x.first().copied()); + if op == Some(8) { + let (screen_rows, screen_cols) = self.screen.size(); + let rows = iter.next().map_or(screen_rows, |x| { + *x.first().unwrap_or(&screen_rows) + }); + let cols = iter.next().map_or(screen_cols, |x| { + *x.first().unwrap_or(&screen_cols) + }); + self.callbacks.resize(self.screen, (rows, cols)); + } + } self.screen.csi_dispatch(params, intermediates, ignore, c); } -- cgit v1.2.3-54-g00ecf