mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 21:32:13 +03:00
conpty: adjust screensize probing
We need a delay, and to be able to swallow a couple of excess xtversion responses in order to read the pixel dimension response.
This commit is contained in:
parent
e2c9c60acd
commit
822a766761
@ -147,14 +147,19 @@ impl<'a> ProbeCapabilities<'a> {
|
|||||||
// terminal and see what it says
|
// terminal and see what it says
|
||||||
if is_tmux {
|
if is_tmux {
|
||||||
write!(self.write, "{TMUX_BEGIN}{query_pixels}{TMUX_END}")?;
|
write!(self.write, "{TMUX_BEGIN}{query_pixels}{TMUX_END}")?;
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_tmux || cfg!(windows) {
|
||||||
self.write.flush()?;
|
self.write.flush()?;
|
||||||
// I really wanted to avoid a delay here, but tmux will re-order the
|
// I really wanted to avoid a delay here, but tmux and conpty will
|
||||||
// response to dev_attributes before it sends the response for the
|
// both re-order the response to dev_attributes before sending the
|
||||||
// passthru of query_pixels if we don't delay. The delay is potentially
|
// response for the passthru of query_pixels if we don't delay.
|
||||||
// imperfect for things like a laggy ssh connection. The consequence
|
// The delay is potentially imperfect for things like a laggy ssh
|
||||||
// of the timing being wrong is that we won't be able to reason about
|
// connection. The consequence of the timing being wrong is that
|
||||||
// the pixel dimensions, which is "OK", but that was kinda the whole
|
// we won't be able to reason about the pixel dimensions, which is
|
||||||
// point of probing this way vs. termios.
|
// "OK", but that was kinda the whole point of probing this way
|
||||||
|
// vs. termios.
|
||||||
|
|
||||||
std::thread::sleep(std::time::Duration::from_millis(100));
|
std::thread::sleep(std::time::Duration::from_millis(100));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,6 +182,14 @@ impl<'a> ProbeCapabilities<'a> {
|
|||||||
parser.parse(&byte, |action| {
|
parser.parse(&byte, |action| {
|
||||||
// print!("{action:?}\r\n");
|
// print!("{action:?}\r\n");
|
||||||
match action {
|
match action {
|
||||||
|
// ConPTY appears to trigger 1 or more xtversion queries
|
||||||
|
// to wezterm in response to this probe, so we need to
|
||||||
|
// prepared to accept and discard data of that shape
|
||||||
|
// here, so that we keep going until we get our reports
|
||||||
|
Action::DeviceControl(_) => {}
|
||||||
|
Action::Esc(Esc::Code(EscCode::StringTerminator)) => {}
|
||||||
|
|
||||||
|
// and now look for the actual responses we're expecting
|
||||||
Action::CSI(csi) => match csi {
|
Action::CSI(csi) => match csi {
|
||||||
CSI::Window(win) => match *win {
|
CSI::Window(win) => match *win {
|
||||||
Window::ResizeWindowCells { width, height } => {
|
Window::ResizeWindowCells { width, height } => {
|
||||||
|
@ -336,8 +336,9 @@ impl ImgCatCommand {
|
|||||||
// explicitly after we've drawn things.
|
// explicitly after we've drawn things.
|
||||||
// We can only do this reasonably sanely if we aren't setting
|
// We can only do this reasonably sanely if we aren't setting
|
||||||
// the absolute position.
|
// the absolute position.
|
||||||
let needs_force_cursor_move =
|
let needs_force_cursor_move = !self.no_move_cursor && !self.position.is_some() && (is_tmux || is_conpty)
|
||||||
!self.no_move_cursor && !self.position.is_some() && (is_tmux || is_conpty);
|
// We can only use forced movement if we know the pixel geometry
|
||||||
|
&& (term_size.xpixel != 0 && term_size.ypixel != 0);
|
||||||
|
|
||||||
term.set_cooked_mode()?;
|
term.set_cooked_mode()?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user