diff options
author | Dominik MiedziĆski <dominik@mdzn.pl> | 2017-05-07 22:08:23 +0200 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-05-07 15:14:22 -0700 |
commit | 08447a220c1bcf9d2e071798da3e1edcde9366cf (patch) | |
tree | 2ad2b65ea6dac3b729b0777bd671a0d9fff9b081 /src | |
parent | 573c5035efaf486a3fc56c05115df456fe053143 (diff) | |
download | alacritty-08447a220c1bcf9d2e071798da3e1edcde9366cf.tar.gz alacritty-08447a220c1bcf9d2e071798da3e1edcde9366cf.zip |
Add support for Query Device Status
Diffstat (limited to 'src')
-rw-r--r-- | src/ansi.rs | 8 | ||||
-rw-r--r-- | src/term/mod.rs | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/ansi.rs b/src/ansi.rs index 18636760..a3f5c2d2 100644 --- a/src/ansi.rs +++ b/src/ansi.rs @@ -128,6 +128,9 @@ pub trait Handler { /// TODO this should probably return an io::Result fn identify_terminal<W: io::Write>(&mut self, &mut W) {} + // Report device status + fn device_status<W: io::Write>(&mut self, &mut W) {} + /// Move cursor forward `cols` fn move_forward(&mut self, Column) {} @@ -716,7 +719,7 @@ impl<'a, H, W> vte::Perform for Performer<'a, H, W> handler.move_up(Line(arg_or_default!(idx: 0, default: 1) as usize)); }, 'B' | 'e' => handler.move_down(Line(arg_or_default!(idx: 0, default: 1) as usize)), - 'c' | 'n' => handler.identify_terminal(writer), + 'c' => handler.identify_terminal(writer), 'C' | 'a' => handler.move_forward(Column(arg_or_default!(idx: 0, default: 1) as usize)), 'D' => handler.move_backward(Column(arg_or_default!(idx: 0, default: 1) as usize)), 'E' => handler.move_down_and_cr(Line(arg_or_default!(idx: 0, default: 1) as usize)), @@ -871,8 +874,7 @@ impl<'a, H, W> vte::Perform for Performer<'a, H, W> i += 1; // C-for expr } } - // TODO this should be a device status report - // 'n' => handler.identify_terminal(writer), + 'n' => handler.device_status(writer), 'r' => { if private { unhandled!(); diff --git a/src/term/mod.rs b/src/term/mod.rs index 9f49ae55..e3510b11 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -1240,6 +1240,11 @@ impl ansi::Handler for Term { } #[inline] + fn device_status<W: io::Write>(&mut self, writer: &mut W) { + let _ = writer.write_all(b"\x1b0n"); + } + + #[inline] fn move_down_and_cr(&mut self, lines: Line) { trace!("[unimplemented] move_down_and_cr: {}", lines); } |