From c47fed927e8fad0395266fb30c58a094e430bee0 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Mon, 30 Nov 2020 09:40:24 +0100 Subject: [PATCH] fic(compatibility): htop scrolling issues (#77) * fix(compatibility): scrolling inside scroll region with 'M' esc dispatch * style(format): make rustfmt happy * fix(tests): send proper data * fix(logs): do not crash if log file doesn't exist --- htop-debugging/currently-debugging.log | Bin 0 -> 1442 bytes htop-debugging/mosaic-3.log | Bin 0 -> 6201 bytes src/main.rs | 5 +- src/pty_bus.rs | 2 +- src/terminal_pane/scroll.rs | 64 ++++++++++++++++-- src/terminal_pane/terminal_pane.rs | 22 ++++-- src/tests/fixtures/htop_scrolling | Bin 0 -> 18484 bytes src/tests/integration/compatibility.rs | 23 +++++++ ...s__integration__compatibility__htop-2.snap | 2 +- ...tion__compatibility__htop_scrolling-2.snap | 32 +++++++++ ...ration__compatibility__htop_scrolling.snap | 32 +++++++++ ...lity__run_bandwhich_from_fish_shell-2.snap | 2 +- src/utils/logging.rs | 11 +++ 13 files changed, 179 insertions(+), 16 deletions(-) create mode 100644 htop-debugging/currently-debugging.log create mode 100644 htop-debugging/mosaic-3.log create mode 100644 src/tests/fixtures/htop_scrolling create mode 100644 src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop_scrolling-2.snap create mode 100644 src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop_scrolling.snap diff --git a/htop-debugging/currently-debugging.log b/htop-debugging/currently-debugging.log new file mode 100644 index 0000000000000000000000000000000000000000..8d0c38c12adde2bfb033ef39a9258560cfc07e85 GIT binary patch literal 1442 zcmds%v2MaJ5QaNf>Jxamu?vaMHjYiUPDrRz$4sD5DHR4O2}phW-i1)&03B$jG6d;< z$9MPL{SgJ`XlhZI+~HglIR^3kA`0#DX>P+*K8XTVNdcc5A4I`2&`)I+M#o*Kce|EF zASrr5Ns3919`DsEK46VIizs6ey*i7K#iBA2-stXxGROq!F_V}`1L?l0(@nKXo6n|Q zhw}74*_Z1BHMHQ)Gs`fLnqAL(0z7$-9C2vdb`}5Htv6V ziI$tlqs%QY`N&WtEC8>d1|_ZlI4j-2Po0yEODLE&Y^G{kwY_V3j6)}Nj-}z< jznfmiH}c5)Mr_a~7I_oS;^<5Es|ESSh`R1@;{5RoPv2Mv literal 0 HcmV?d00001 diff --git a/htop-debugging/mosaic-3.log b/htop-debugging/mosaic-3.log new file mode 100644 index 0000000000000000000000000000000000000000..f0afca478b17886052f3036d094e7ac247eac86f GIT binary patch literal 6201 zcmds5+iu%N5cOM&0R95L>`Q5u< z7HEH?Z~Z5KNzX1xi5JN=l(R zl1-xNC)QYafgMm~jg|G;v*ITguDbdCw|tHK^RGiVCx_Pf^xH6=0ykMEL`U(MEaxG4 zn?~Vc7GINSu?*A6bQxWRB%6nEeE8tN8b9Tf%K3q{SLDnF6H-&+sGDDZ`MjW@;6|-TDyg^dMSfBZQ$#N@% z%&2#SKaw3C%wg=@$(Y0H&ZeIh?tN8r&@6%5!0{vSYzl|N3{jI#XBNhj>nDtEUWh^i z+gf0E+uc{oik}bcMrhLP5}*!bXEMY(USEA!6eerjevZVO@~PLGqdp+7aD}XGQgU0w zuswXxN}cJfST~lg^gBuliuoy{(nqnefXOtE5I|yFaOc(&-LW=)2tSZMx)0WrqJP&5 zxiAf^G5-?p89^VJnsO8~-;4VKrVYpC{>Frb%#>xQ3zdA}hFxB~e+*nG{{_e9?l} zV|G_yId=(6ZX46+$IH^7ydRi0{<*4UrbSk|M(%v97oUgsyz z$*a-vFh5tE4^IeriT5`r!wW18k4N|%4TfY?7T)@PM;)ENde~a#>g@RJA?~_3IXiwt z$WfxyWC0APz``iL7~GX@2yuNX7}4jU90uVOU-0$>Lu*N9JA?@CI%G(s?4nGNM||{k zS=z)1;C6AwjAtxxQD|jKbq6q@uGOcf(j-~t&g-TnlmfP+2y@vPVbFu>j*jWOqBDut zxJW(lS77c!Cuv`LT`cypH_@UOEh0=-2GJXEN4NC8(0oz%E4VDv<0t{et0HC|tz6{w zi$22HAVvxd)xJx5t1Rus(VJd&oh?H(EB|)BPgdz-5+l6~LO0O4+CLD{fa6F_OTjLq zb*#+in~TJ)U&LIk1Y)SCtV`wYKvuKxYNkt7&R*ywYq6~q>mZCTt16|->4k>dup5QT z)uqN&3`Aq6^V71Mq*ILJnw?Hn!|p{C<9yw)gNiooF48b;;d9z{qaC@FD|`t%YFSj5gK% zZz`kGbtW_a?Wt6pp?0Rl+m;sBqYlnWj0vQL_AX!kD><(`VN}Lu$^QM7jrMPtY33ZP?B9)UV?$P@58lBV~fN8!Es+t!korjp`p|R>kPc+|6kf( o*g`X+p9Oan_I*DQnv_?R0&w(MYX5>R&s-3P%C_(SSZL_|3yF*8P5=M^ literal 0 HcmV?d00001 diff --git a/src/main.rs b/src/main.rs index 96b50cb23..0f5fcf063 100644 --- a/src/main.rs +++ b/src/main.rs @@ -450,10 +450,11 @@ pub fn start(mut os_input: Box, opts: Opt) { } // cleanup(); let reset_style = "\u{1b}[m"; + let show_cursor = "\u{1b}[?25h"; let goto_start_of_last_line = format!("\u{1b}[{};{}H", full_screen_ws.rows, 1); let goodbye_message = format!( - "{}\n{}Bye from Mosaic!", - goto_start_of_last_line, reset_style + "{}\n{}{}Bye from Mosaic!", + goto_start_of_last_line, reset_style, show_cursor ); os_input.unset_raw_mode(0); diff --git a/src/pty_bus.rs b/src/pty_bus.rs index 078e32715..3c8abcff9 100644 --- a/src/pty_bus.rs +++ b/src/pty_bus.rs @@ -11,7 +11,7 @@ use std::path::PathBuf; use crate::layout::Layout; use crate::os_input_output::OsApi; -use crate::utils::logging::debug_to_file; +use crate::utils::logging::{debug_log_to_file, debug_to_file}; use crate::ScreenInstruction; pub struct ReadFromPid { diff --git a/src/terminal_pane/scroll.rs b/src/terminal_pane/scroll.rs index 336c17bfd..bfd6bd311 100644 --- a/src/terminal_pane/scroll.rs +++ b/src/terminal_pane/scroll.rs @@ -135,6 +135,28 @@ impl CanonicalLine { self.wrapped_fragments.truncate(fragment_index + 1); } + pub fn replace_with_empty_chars_before_cursor( + &mut self, + fragment_index: usize, + until_col: usize, + style_of_empty_space: CharacterStyles, + ) { + let mut empty_char_character = EMPTY_TERMINAL_CHARACTER; + empty_char_character.styles = style_of_empty_space; + + if fragment_index > 0 { + for i in 0..(fragment_index - 1) { + let fragment = self.wrapped_fragments.get_mut(i).unwrap(); + for i in 0..fragment.characters.len() { + fragment.add_character(empty_char_character, i); + } + } + } + let current_fragment = self.wrapped_fragments.get_mut(fragment_index).unwrap(); + for i in 0..until_col { + current_fragment.add_character(empty_char_character, i); + } + } } impl Debug for CanonicalLine { @@ -331,21 +353,18 @@ impl Scroll { pub fn add_canonical_line(&mut self) { let current_canonical_line_index = self.cursor_position.line_index.0; if let Some((scroll_region_top, scroll_region_bottom)) = self.scroll_region { - // the scroll region indices start at 1, so we need to adjust them if self.show_cursor { // scroll region should be ignored if the cursor is hidden - let scroll_region_top_index = scroll_region_top - 1; - let scroll_region_bottom_index = scroll_region_bottom - 1; - if current_canonical_line_index == scroll_region_bottom_index + 1 { + if current_canonical_line_index == scroll_region_bottom { // end of scroll region // when we have a scroll region set and we're at its bottom // we need to delete its first line, thus shifting all lines in it upwards // then we add an empty line at its end which will be filled by the application // controlling the scroll region (presumably filled by whatever comes next in the // scroll buffer, but that's not something we control) - self.canonical_lines.remove(scroll_region_top_index); + self.canonical_lines.remove(scroll_region_top); self.canonical_lines - .insert(scroll_region_bottom_index + 1, CanonicalLine::new()); + .insert(scroll_region_bottom, CanonicalLine::new()); return; } } @@ -473,6 +492,20 @@ impl Scroll { style_of_empty_space, ); } + pub fn clear_canonical_line_left_of_cursor(&mut self, style_of_empty_space: CharacterStyles) { + let (current_canonical_line_index, current_line_wrap_position) = + self.cursor_position.line_index; + let current_cursor_column_position = self.cursor_position.column_index; + let current_canonical_line = self + .canonical_lines + .get_mut(current_canonical_line_index) + .expect("cursor out of bounds"); + current_canonical_line.replace_with_empty_chars_before_cursor( + current_line_wrap_position, + current_cursor_column_position, + style_of_empty_space, + ); + } pub fn clear_all_after_cursor(&mut self) { let (current_canonical_line_index, current_line_wrap_position) = self.cursor_position.line_index; @@ -592,6 +625,25 @@ impl Scroll { } } } + pub fn move_cursor_up_in_scroll_region(&mut self, count: usize) { + if let Some((scroll_region_top, scroll_region_bottom)) = self.scroll_region { + // the scroll region indices start at 1, so we need to adjust them + for _ in 0..count { + let current_canonical_line_index = self.cursor_position.line_index.0; + if current_canonical_line_index == scroll_region_top { + // if we're at the top line, we create a new line and remove the last line that + // would otherwise overflow + self.canonical_lines.remove(scroll_region_bottom); + self.canonical_lines + .insert(current_canonical_line_index, CanonicalLine::new()); + } else if current_canonical_line_index > scroll_region_top + && current_canonical_line_index <= scroll_region_bottom + { + self.move_cursor_up(count); + } + } + } + } /// [scroll_up](https://github.com/alacritty/alacritty/blob/ec42b42ce601808070462111c0c28edb0e89babb/alacritty_terminal/src/grid/mod.rs#L261) /// This function takes the first line of the scroll region and moves it to the bottom (count times) pub fn rotate_scroll_region_up(&mut self, count: usize) { diff --git a/src/terminal_pane/terminal_pane.rs b/src/terminal_pane/terminal_pane.rs index 42062e24f..73635b1fd 100644 --- a/src/terminal_pane/terminal_pane.rs +++ b/src/terminal_pane/terminal_pane.rs @@ -687,8 +687,11 @@ impl vte::Perform for TerminalPane { if params[0] == 0 { self.scroll .clear_canonical_line_right_of_cursor(self.pending_styles); + } else if params[0] == 1 { + self.scroll + .clear_canonical_line_left_of_cursor(self.pending_styles); } - // TODO: implement 1 and 2 + // TODO: implement 2 } else if c == 'J' { // clear all (0 => below, 1 => above, 2 => all, 3 => saved) if params[0] == 0 { @@ -826,12 +829,21 @@ impl vte::Perform for TerminalPane { self.scroll.delete_lines_in_scroll_region(count); self.scroll.add_empty_lines_in_scroll_region(count); } else { - debug_log_to_file(format!("Unhandled csi: {}->{:?}", c, params)).unwrap(); - panic!("unhandled csi: {}->{:?}", c, params); + let _ = debug_log_to_file(format!("Unhandled csi: {}->{:?}", c, params)); } } - fn esc_dispatch(&mut self, _intermediates: &[u8], _ignore: bool, _byte: u8) { - // TBD + fn esc_dispatch(&mut self, intermediates: &[u8], _ignore: bool, byte: u8) { + match (byte, intermediates.get(0)) { + (b'M', None) => { + self.scroll.move_cursor_up_in_scroll_region(1); + } + _ => { + let _ = debug_log_to_file(format!( + "Unhandled esc_dispatch: {}->{:?}", + byte, intermediates + )); + } + } } } diff --git a/src/tests/fixtures/htop_scrolling b/src/tests/fixtures/htop_scrolling new file mode 100644 index 0000000000000000000000000000000000000000..4e0df6296cfc787d0546ce61ade3a28951916616 GIT binary patch literal 18484 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 literal 0 HcmV?d00001 diff --git a/src/tests/integration/compatibility.rs b/src/tests/integration/compatibility.rs index c244f5bf0..cb378ef57 100644 --- a/src/tests/integration/compatibility.rs +++ b/src/tests/integration/compatibility.rs @@ -214,3 +214,26 @@ pub fn htop() { assert_snapshot!(snapshot); } } + +#[test] +pub fn htop_scrolling() { + let fake_win_size = PositionAndSize { + columns: 116, + rows: 28, + x: 0, + y: 0, + }; + let fixture_name = "htop_scrolling"; + 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__htop-2.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop-2.snap index 2fa4647b0..3754cdd44 100644 --- a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop-2.snap +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop-2.snap @@ -29,4 +29,4 @@ expression: snapshot 99272 aram 20 0 8456 4348 3320 R 1.3 0.0 0:00.13 htop 8611 aram 20 0 2944M 318M 130M S 1.3 2.0 8:17.90 /usr/lib/firefox/firefox -contentproc -childID 6 -i F1Help F2Setup F3SearchF4FilterF5Tree F6SortByF7Nice -F8Nice +F9Kill F10Quit -Bye from Mosaic! +Bye from Mosaic!█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop_scrolling-2.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop_scrolling-2.snap new file mode 100644 index 000000000..c4f6568cc --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop_scrolling-2.snap @@ -0,0 +1,32 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- + 1 [||||||||||||||||||||||||||||||||||||||||||100.0%] Tasks: 79, 382 thr; 1 running + 2 [ 0.0%] Load average: 1.40 1.43 1.38 + 3 [ 0.0%] Uptime: 2 days, 07:33:50 + 4 [ 0.0%] + Mem[|||||||||||||||||||||||||||||||||||||3.64G/15.3G] + Swp[ 0K/16.0G] + + PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command + 123934 aram 20 0 8444 4384 3364 R 66.7 0.0 0:00.05 htop --delay=100000000000 + 1 root 20 0 171M 11616 8608 S 0.0 0.1 0:56.91 /sbin/init + 268 root 20 0 93324 34340 33072 S 0.0 0.2 0:01.05 /usr/lib/systemd/systemd-journald + 276 root 20 0 32648 10192 7240 S 0.0 0.1 0:01.13 /usr/lib/systemd/systemd-udevd + 286 root 20 0 78060 1132 996 S 0.0 0.0 0:00.00 /usr/bin/lvmetad -f + 343 dbus 20 0 6952 4384 3520 S 0.0 0.0 0:13.85 /usr/bin/dbus-daemon --system --address=systemd: -- + 344 root 20 0 14588 7512 6176 S 0.0 0.0 0:03.21 /usr/bin/connmand -n --nodnsproxy + 345 root 20 0 17696 8372 7128 S 0.0 0.1 0:00.67 /usr/lib/systemd/systemd-logind + 395 root 20 0 1635M 83324 44976 S 0.0 0.5 0:32.43 /usr/bin/dockerd -H fd:// + 396 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.01 /usr/bin/dockerd -H fd:// + 397 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.01 /usr/bin/dockerd -H fd:// + 398 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.00 /usr/bin/dockerd -H fd:// + 399 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.00 /usr/bin/dockerd -H fd:// + 412 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.00 /usr/bin/dockerd -H fd:// + 441 root 20 0 1635M 83324 44976 S 0.0 0.5 0:41.35 /usr/bin/dockerd -H fd:// + 442 root 20 0 1635M 83324 44976 S 0.0 0.5 0:33.61 /usr/bin/dockerd -H fd:// + 444 root 20 0 1635M 83324 44976 S 0.0 0.5 0:33.13 /usr/bin/dockerd -H fd:// + 449 root 20 0 1635M 83324 44976 S 0.0 0.5 0:41.39 /usr/bin/dockerd -H fd:// +F1Help F2Setup F3SearchF4FilterF5Tree F6SortByF7Nice -F8Nice +F9Kill F10Quit +Bye from Mosaic!█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop_scrolling.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop_scrolling.snap new file mode 100644 index 000000000..fdf6cf890 --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop_scrolling.snap @@ -0,0 +1,32 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- + 1 [||||||||||||||||||||||||||||||||||||||||||100.0%] Tasks: 79, 382 thr; 1 running + 2 [ 0.0%] Load average: 1.40 1.43 1.38 + 3 [ 0.0%] Uptime: 2 days, 07:33:50 + 4 [ 0.0%] + Mem[|||||||||||||||||||||||||||||||||||||3.64G/15.3G] + Swp[ 0K/16.0G] + + PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command + 123934 aram 20 0 8444 4384 3364 R 66.7 0.0 0:00.05 htop --delay=100000000000 + 1 root 20 0 171M 11616 8608 S 0.0 0.1 0:56.91 /sbin/init + 268 root 20 0 93324 34340 33072 S 0.0 0.2 0:01.05 /usr/lib/systemd/systemd-journald + 276 root 20 0 32648 10192 7240 S 0.0 0.1 0:01.13 /usr/lib/systemd/systemd-udevd + 286 root 20 0 78060 1132 996 S 0.0 0.0 0:00.00 /usr/bin/lvmetad -f + 343 dbus 20 0 6952 4384 3520 S 0.0 0.0 0:13.85 /usr/bin/dbus-daemon --system --address=systemd: -- + 344 root 20 0 14588 7512 6176 S 0.0 0.0 0:03.21 /usr/bin/connmand -n --nodnsproxy + 345 root 20 0 17696 8372 7128 S 0.0 0.1 0:00.67 /usr/lib/systemd/systemd-logind + 395 root 20 0 1635M 83324 44976 S 0.0 0.5 0:32.43 /usr/bin/dockerd -H fd:// + 396 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.01 /usr/bin/dockerd -H fd:// + 397 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.01 /usr/bin/dockerd -H fd:// + 398 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.00 /usr/bin/dockerd -H fd:// + 399 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.00 /usr/bin/dockerd -H fd:// + 412 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.00 /usr/bin/dockerd -H fd:// + 441 root 20 0 1635M 83324 44976 S 0.0 0.5 0:41.35 /usr/bin/dockerd -H fd:// + 442 root 20 0 1635M 83324 44976 S 0.0 0.5 0:33.61 /usr/bin/dockerd -H fd:// + 444 root 20 0 1635M 83324 44976 S 0.0 0.5 0:33.13 /usr/bin/dockerd -H fd:// + 449 root 20 0 1635M 83324 44976 S 0.0 0.5 0:41.39 /usr/bin/dockerd -H fd:// +F1Help F2Setup F3SearchF4FilterF5Tree F6SortByF7Nice -F8Nice +F9Kill F10Quit +█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__run_bandwhich_from_fish_shell-2.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__run_bandwhich_from_fish_shell-2.snap index 8ca0fe37d..9c90df819 100644 --- a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__run_bandwhich_from_fish_shell-2.snap +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__run_bandwhich_from_fish_shell-2.snap @@ -29,4 +29,4 @@ expression: snapshot │ │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press to pause. Use to rearrange tables. (DNS queries hidden). -Bye from Mosaic! +Bye from Mosaic!█ diff --git a/src/utils/logging.rs b/src/utils/logging.rs index 1af1cb067..e175050ec 100644 --- a/src/utils/logging.rs +++ b/src/utils/logging.rs @@ -33,6 +33,17 @@ pub fn debug_log_to_file(message: String) -> io::Result<()> { file.write_all(b"\n") } +pub fn debug_log_to_file_without_newline(message: String) -> io::Result<()> { + atomic_create_file(MOSAIC_TMP_LOG_FILE); + let mut file = fs::OpenOptions::new() + .append(true) + .create(true) + .open(MOSAIC_TMP_LOG_FILE)?; + file.write_all(message.as_bytes())?; + + Ok(()) +} + pub fn debug_log_to_file_pid_0(message: String, pid: RawFd) -> io::Result<()> { if pid == 0 { debug_log_to_file(message)