diff options
| author | Aram Drevekenin <aram@poor.dev> | 2020-11-06 18:12:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-06 18:12:03 +0100 |
| commit | 13af16b3360dddc8aede1e7c429696b115fadd6d (patch) | |
| tree | f1102cfde94ee9f2d8dc10eb93c79884790b8eaf /src/tests/utils.rs | |
| parent | docs(architecture): fix title (diff) | |
| download | sl0ppij-13af16b3360dddc8aede1e7c429696b115fadd6d.tar.gz sl0ppij-13af16b3360dddc8aede1e7c429696b115fadd6d.tar.xz sl0ppij-13af16b3360dddc8aede1e7c429696b115fadd6d.zip | |
fix(scroll): support show/hide cursor and fix vim scrolling behaviour (#27)
Diffstat (limited to 'src/tests/utils.rs')
| -rw-r--r-- | src/tests/utils.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/tests/utils.rs b/src/tests/utils.rs index 1e76b31f..779c72a4 100644 --- a/src/tests/utils.rs +++ b/src/tests/utils.rs @@ -14,15 +14,17 @@ pub fn get_output_frame_snapshots(output_frames: &[Vec<u8>], win_size: &Winsize) vte_parser.advance(&mut terminal_output, *byte); } let output_lines = terminal_output.read_buffer_as_lines(); - let (cursor_x, cursor_y) = terminal_output.cursor_coordinates(); + let cursor_coordinates = terminal_output.cursor_coordinates(); let mut snapshot = String::new(); for (line_index, line) in output_lines.iter().enumerate() { for (character_index, terminal_character) in line.iter().enumerate() { - if line_index == cursor_y && character_index == cursor_x { - snapshot.push('█'); - } else { - snapshot.push(terminal_character.character); + if let Some((cursor_x, cursor_y)) = cursor_coordinates { + if line_index == cursor_y && character_index == cursor_x { + snapshot.push('█'); + continue; + } } + snapshot.push(terminal_character.character); } if line_index != output_lines.len() - 1 { snapshot.push('\n'); |
