fix(compatibility): fix bash linewrap (#109)
This commit is contained in:
parent
f1f821c7bd
commit
97980d618f
5 changed files with 90 additions and 1 deletions
|
|
@ -384,7 +384,7 @@ impl Scroll {
|
||||||
.get_mut(wrapped_fragment_index_in_line)
|
.get_mut(wrapped_fragment_index_in_line)
|
||||||
.expect("cursor out of bounds");
|
.expect("cursor out of bounds");
|
||||||
|
|
||||||
if cursor_position_in_line <= self.total_columns {
|
if cursor_position_in_line < self.total_columns {
|
||||||
current_wrapped_fragment.add_character(terminal_character, cursor_position_in_line);
|
current_wrapped_fragment.add_character(terminal_character, cursor_position_in_line);
|
||||||
self.cursor_position.move_forward(1);
|
self.cursor_position.move_forward(1);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
BIN
src/tests/fixtures/bash_cursor_linewrap
vendored
Normal file
BIN
src/tests/fixtures/bash_cursor_linewrap
vendored
Normal file
Binary file not shown.
|
|
@ -363,3 +363,28 @@ pub fn neovim_insert_mode() {
|
||||||
assert_snapshot!(snapshot);
|
assert_snapshot!(snapshot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
pub fn bash_cursor_linewrap() {
|
||||||
|
// this test makes sure that when we enter a command that is beyond the screen border, that it
|
||||||
|
// immediately goes down one line
|
||||||
|
let fake_win_size = PositionAndSize {
|
||||||
|
columns: 116,
|
||||||
|
rows: 28,
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
};
|
||||||
|
let fixture_name = "bash_cursor_linewrap";
|
||||||
|
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
|
||||||
|
---
|
||||||
|
⋊> ~/c/mosaic on main ⨯ bash 16:00:06
|
||||||
|
[aram@green mosaic]$ 12345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Bye from Mosaic!█
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
source: src/tests/integration/compatibility.rs
|
||||||
|
expression: snapshot
|
||||||
|
---
|
||||||
|
Welcome to fish, the friendly interactive shell
|
||||||
|
⋊> ~/c/mosaic on main ⨯ bash 16:00:06
|
||||||
|
[aram@green mosaic]$ 12345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345
|
||||||
|
█
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue