Merge pull request #131 from mosaic-org/mosaic#130
fix: fixes #130 by adding overflowing_sub
This commit is contained in:
commit
610545f54a
6 changed files with 216 additions and 1 deletions
|
|
@ -266,7 +266,7 @@ impl CursorPosition {
|
||||||
self.column_index += count;
|
self.column_index += count;
|
||||||
}
|
}
|
||||||
pub fn move_backwards(&mut self, count: usize) {
|
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) {
|
pub fn move_to_next_linewrap(&mut self) {
|
||||||
self.line_index.1 += 1;
|
self.line_index.1 += 1;
|
||||||
|
|
|
||||||
BIN
src/tests/fixtures/emacs_longbuf_tutorial
vendored
Normal file
BIN
src/tests/fixtures/emacs_longbuf_tutorial
vendored
Normal file
Binary file not shown.
|
|
@ -461,3 +461,26 @@ pub fn git_diff_scrollup() {
|
||||||
assert_snapshot!(snapshot);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
█
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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!█
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
---
|
||||||
|
source: src/tests/integration/compatibility.rs
|
||||||
|
expression: snapshot
|
||||||
|
---
|
||||||
|
█
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue