diff --git a/src/terminal_pane/terminal_pane.rs b/src/terminal_pane/terminal_pane.rs index 6754974c..0901b8c9 100644 --- a/src/terminal_pane/terminal_pane.rs +++ b/src/terminal_pane/terminal_pane.rs @@ -368,6 +368,15 @@ impl vte::Perform for TerminalPane { // backspace 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 => { // 0a, newline self.add_newline(); diff --git a/src/tests/fixtures/tab_characters b/src/tests/fixtures/tab_characters new file mode 100644 index 00000000..cf40aac5 Binary files /dev/null and b/src/tests/fixtures/tab_characters differ diff --git a/src/tests/integration/compatibility.rs b/src/tests/integration/compatibility.rs index 1df46583..6fbf99e9 100644 --- a/src/tests/integration/compatibility.rs +++ b/src/tests/integration/compatibility.rs @@ -317,3 +317,26 @@ pub fn clear_scroll_region() { 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); + } +} diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__display_tab_characters_properly-2.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__display_tab_characters_properly-2.snap new file mode 100644 index 00000000..ce9f3423 --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__display_tab_characters_properly-2.snap @@ -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!█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__display_tab_characters_properly.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__display_tab_characters_properly.snap new file mode 100644 index 00000000..ec9cd4cd --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__display_tab_characters_properly.snap @@ -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) | █ + + + + + + + + + + + + +