Implement passing the bell signal to the terminal (#981)
* implement passing the bell signal to the terminal * Add files via upload add fixture to test against
This commit is contained in:
parent
82384dc970
commit
00e923cfdc
4 changed files with 28 additions and 0 deletions
6
src/tests/fixtures/ring_bell
vendored
Normal file
6
src/tests/fixtures/ring_bell
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[?2004h
|
||||
[1;36mzellij[0m on [1;35m [0m[1;35mmain[0m [1;31m[[0m[1;31m![0m[1;31m][0m is [1;38;5;208m📦 [0m[1;38;5;208mv0.24.0[0m via [1;31m🦀 [0m[1;31mv1.57.0[0m[1;31m [0m
|
||||
[1;32m❯[0m
[K[1;32m❯[0m bell
|
||||
[?2004l
[?2004h
|
||||
[1;36mzellij[0m on [1;35m [0m[1;35mmain[0m [1;31m[[0m[1;31m![0m[1;31m][0m is [1;38;5;208m📦 [0m[1;38;5;208mv0.24.0[0m via [1;31m🦀 [0m[1;31mv1.57.0[0m[1;31m [0mtook [1;33m5s[0m
|
||||
[1;32m❯[0m
|
||||
|
|
@ -399,6 +399,7 @@ pub struct Grid {
|
|||
pub title: Option<String>,
|
||||
pub is_scrolled: bool,
|
||||
pub link_handler: LinkHandler,
|
||||
pub ring_bell: bool,
|
||||
scrollback_buffer_lines: usize,
|
||||
}
|
||||
|
||||
|
|
@ -446,6 +447,7 @@ impl Grid {
|
|||
changed_colors: None,
|
||||
is_scrolled: false,
|
||||
link_handler: Default::default(),
|
||||
ring_bell: false,
|
||||
scrollback_buffer_lines: 0,
|
||||
}
|
||||
}
|
||||
|
|
@ -1506,6 +1508,9 @@ impl Perform for Grid {
|
|||
|
||||
fn execute(&mut self, byte: u8) {
|
||||
match byte {
|
||||
7 => {
|
||||
self.ring_bell = true;
|
||||
}
|
||||
8 => {
|
||||
// backspace
|
||||
self.move_cursor_back(1);
|
||||
|
|
|
|||
|
|
@ -273,6 +273,11 @@ impl Pane for TerminalPane {
|
|||
}
|
||||
character_styles.clear();
|
||||
}
|
||||
if self.grid.ring_bell {
|
||||
let ring_bell = '\u{7}';
|
||||
vte_output.push(ring_bell);
|
||||
self.grid.ring_bell = false;
|
||||
}
|
||||
self.set_should_render(false);
|
||||
Some(vte_output)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1078,3 +1078,15 @@ pub fn full_screen_scroll_region_and_scroll_up() {
|
|||
grid.scroll_up_one_line();
|
||||
assert_snapshot!(format!("{:?}", grid));
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn ring_bell() {
|
||||
let mut vte_parser = vte::Parser::new();
|
||||
let mut grid = Grid::new(134, 64, Palette::default());
|
||||
let fixture_name = "ring_bell";
|
||||
let content = read_fixture(fixture_name);
|
||||
for byte in content {
|
||||
vte_parser.advance(&mut grid, byte);
|
||||
}
|
||||
assert!(grid.ring_bell);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue