fix(compatibility): handle tab characters properly (#99)
* fix(compatibility): handle tab characters properly * style(formatting): make rustfmt happy
This commit is contained in:
parent
ac9c0274f4
commit
38d8e2238d
5 changed files with 96 additions and 0 deletions
|
|
@ -368,6 +368,15 @@ impl vte::Perform for TerminalPane {
|
||||||
// backspace
|
// backspace
|
||||||
self.move_cursor_backwards(1);
|
self.move_cursor_backwards(1);
|
||||||
}
|
}
|
||||||
|
9 => {
|
||||||
|
// tab
|
||||||
|
let terminal_tab_character = TerminalCharacter {
|
||||||
|
character: '\t',
|
||||||
|
styles: self.pending_styles,
|
||||||
|
};
|
||||||
|
// TODO: handle better with line wrapping
|
||||||
|
self.scroll.add_character(terminal_tab_character);
|
||||||
|
}
|
||||||
10 => {
|
10 => {
|
||||||
// 0a, newline
|
// 0a, newline
|
||||||
self.add_newline();
|
self.add_newline();
|
||||||
|
|
|
||||||
BIN
src/tests/fixtures/tab_characters
vendored
Normal file
BIN
src/tests/fixtures/tab_characters
vendored
Normal file
Binary file not shown.
|
|
@ -317,3 +317,26 @@ pub fn clear_scroll_region() {
|
||||||
assert_snapshot!(snapshot);
|
assert_snapshot!(snapshot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
pub fn display_tab_characters_properly() {
|
||||||
|
let fake_win_size = PositionAndSize {
|
||||||
|
columns: 116,
|
||||||
|
rows: 28,
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
};
|
||||||
|
let fixture_name = "tab_characters";
|
||||||
|
let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name);
|
||||||
|
fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]);
|
||||||
|
start(Box::new(fake_input_output.clone()), Opt::default());
|
||||||
|
let output_frames = fake_input_output
|
||||||
|
.stdout_writer
|
||||||
|
.output_frames
|
||||||
|
.lock()
|
||||||
|
.unwrap();
|
||||||
|
let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
|
||||||
|
for snapshot in snapshots {
|
||||||
|
assert_snapshot!(snapshot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
source: src/tests/integration/compatibility.rs
|
||||||
|
expression: snapshot
|
||||||
|
---
|
||||||
|
OS: 5.9.13-arch1-1 GNU/Linux
|
||||||
|
Uptime: 10 hours, 42 minutes
|
||||||
|
Hostname: kingdom
|
||||||
|
Disk usage:
|
||||||
|
|
||||||
|
df: /run/user/1000/doc: Operation not permitted
|
||||||
|
/ 321G / 514G 66%
|
||||||
|
/efi 27M / 96M 28%
|
||||||
|
|
||||||
|
Network:
|
||||||
|
|
||||||
|
wlp2s0 192.168.0.3
|
||||||
|
|
||||||
|
[I] [20:07] kingdom:mosaic (main) |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Bye from Mosaic!█
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
source: src/tests/integration/compatibility.rs
|
||||||
|
expression: snapshot
|
||||||
|
---
|
||||||
|
|
||||||
|
OS: 5.9.13-arch1-1 GNU/Linux
|
||||||
|
Uptime: 10 hours, 42 minutes
|
||||||
|
Hostname: kingdom
|
||||||
|
Disk usage:
|
||||||
|
|
||||||
|
df: /run/user/1000/doc: Operation not permitted
|
||||||
|
/ 321G / 514G 66%
|
||||||
|
/efi 27M / 96M 28%
|
||||||
|
|
||||||
|
Network:
|
||||||
|
|
||||||
|
wlp2s0 192.168.0.3
|
||||||
|
|
||||||
|
[I] [20:07] kingdom:mosaic (main) | █
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue