diff options
| author | Brooks J Rady <b.j.rady@gmail.com> | 2021-01-06 20:31:29 +0000 |
|---|---|---|
| committer | Brooks J Rady <b.j.rady@gmail.com> | 2021-01-06 20:31:29 +0000 |
| commit | b5f906617288f10759c764103b6cbc44f1ef165d (patch) | |
| tree | 80ef80457a8f97e7c5a15461f9cd8e4eddead370 /src | |
| parent | Add a FIXME for a clippy lint (diff) | |
| parent | Merge pull request #131 from mosaic-org/mosaic#130 (diff) | |
| download | sl0ppij-b5f906617288f10759c764103b6cbc44f1ef165d.tar.gz sl0ppij-b5f906617288f10759c764103b6cbc44f1ef165d.tar.xz sl0ppij-b5f906617288f10759c764103b6cbc44f1ef165d.zip | |
Merge branch 'main' into wasm-launchable
Diffstat (limited to 'src')
6 files changed, 216 insertions, 1 deletions
diff --git a/src/panes/scroll.rs b/src/panes/scroll.rs index 2dedd1e7..98d1b6f4 100644 --- a/src/panes/scroll.rs +++ b/src/panes/scroll.rs @@ -269,7 +269,7 @@ impl CursorPosition { self.column_index += count; } pub fn move_backwards(&mut self, count: usize) { - self.column_index -= count; + self.column_index = u32::overflowing_sub(self.column_index as u32, count as u32).0 as usize; } pub fn move_to_next_linewrap(&mut self) { self.line_index.1 += 1; diff --git a/src/tests/fixtures/emacs_longbuf_tutorial b/src/tests/fixtures/emacs_longbuf_tutorial Binary files differnew file mode 100644 index 00000000..f383e6d1 --- /dev/null +++ b/src/tests/fixtures/emacs_longbuf_tutorial diff --git a/src/tests/integration/compatibility.rs b/src/tests/integration/compatibility.rs index 75c7f80f..d6d63489 100644 --- a/src/tests/integration/compatibility.rs +++ b/src/tests/integration/compatibility.rs @@ -461,3 +461,26 @@ pub fn git_diff_scrollup() { assert_snapshot!(snapshot); } } + +#[test] +pub fn emacs_longbuf() { + let fake_win_size = PositionAndSize { + columns: 284, + rows: 60, + x: 0, + y: 0, + }; + let fixture_name = "emacs_longbuf_tutorial"; + 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__emacs_longbuf-2.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__emacs_longbuf-2.snap new file mode 100644 index 00000000..6ab342a0 --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__emacs_longbuf-2.snap @@ -0,0 +1,64 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- +➜ mosaic git:(mosaic#130) emacs +➜ mosaic git:(mosaic#130) emacs -nw +➜ mosaic git:(mosaic#130) exit +█ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__emacs_longbuf-3.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__emacs_longbuf-3.snap new file mode 100644 index 00000000..644e2213 --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__emacs_longbuf-3.snap @@ -0,0 +1,64 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- +➜ mosaic git:(mosaic#130) emacs -nw +➜ mosaic git:(mosaic#130) exit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Bye from Mosaic!█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__emacs_longbuf.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__emacs_longbuf.snap new file mode 100644 index 00000000..8741ce12 --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__emacs_longbuf.snap @@ -0,0 +1,64 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- +█ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
