From dfcd3dda589f3643dca33401f41560dba1c2ca2a Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Wed, 14 Oct 2020 19:04:26 +0200 Subject: [PATCH] fix(vim): properly delete last line --- src/terminal_pane.rs | 2 +- ...mosaic__tests__integration__compatibility__vim_ctrl_d-2.snap | 2 +- .../mosaic__tests__integration__compatibility__vim_ctrl_d.snap | 2 +- ...mosaic__tests__integration__compatibility__vim_ctrl_u-2.snap | 2 +- .../mosaic__tests__integration__compatibility__vim_ctrl_u.snap | 2 +- ...s__integration__compatibility__vim_scroll_region_down-2.snap | 2 +- ...sts__integration__compatibility__vim_scroll_region_down.snap | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/terminal_pane.rs b/src/terminal_pane.rs index 09eeb85fb..bbbe72083 100644 --- a/src/terminal_pane.rs +++ b/src/terminal_pane.rs @@ -1156,7 +1156,7 @@ impl vte::Perform for TerminalOutput { let newlines = self.newline_indices.iter().rev(); let mut delete_until = self.characters.len(); for newline_index in newlines { - if newline_index < &self.cursor_position { + if newline_index <= &self.cursor_position { break; } delete_until = *newline_index; diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_d-2.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_d-2.snap index 5a3f7ce59..6498a6e69 100644 --- a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_d-2.snap +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_d-2.snap @@ -28,5 +28,5 @@ expression: snapshot 21 line38 22 line39 NORMAL testfile.rs unix | utf-8 | rust 40% 17:1 -"/tmp/testfile.rs" 42L, 285C + Bye from Mosaic!█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_d.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_d.snap index b4eee2eac..8702c85f4 100644 --- a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_d.snap +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_d.snap @@ -29,4 +29,4 @@ expression: snapshot 21 line38 22 line39 NORMAL testfile.rs unix | utf-8 | rust 40% 17:1 -"/tmp/testfile.rs" 42L, 285C + diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_u-2.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_u-2.snap index 82d924a05..ef757b833 100644 --- a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_u-2.snap +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_u-2.snap @@ -28,5 +28,5 @@ expression: snapshot 2 line28 3 line29 NORMAL testfile.rs unix | utf-8 | rust 61% 26:1 -"/tmp/testfile.rs" 42L, 285C + Bye from Mosaic!█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_u.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_u.snap index cdb821f9f..7d897eb56 100644 --- a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_u.snap +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_ctrl_u.snap @@ -29,4 +29,4 @@ expression: snapshot 2 line28 3 line29 NORMAL testfile.rs unix | utf-8 | rust 61% 26:1 -"/tmp/testfile.rs" 42L, 285C + diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_scroll_region_down-2.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_scroll_region_down-2.snap index a897b376d..f4813a7ff 100644 --- a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_scroll_region_down-2.snap +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_scroll_region_down-2.snap @@ -28,5 +28,5 @@ expression: snapshot 2 line26 3 line27 NORMAL testfile.rs unix | utf-8 | rust 57% 24:1 -"/tmp/testfile.rs" 42L, 285C + Bye from Mosaic!█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_scroll_region_down.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_scroll_region_down.snap index 3ca2370e2..d5c046673 100644 --- a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_scroll_region_down.snap +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__vim_scroll_region_down.snap @@ -29,4 +29,4 @@ expression: snapshot 2 line26 3 line27 NORMAL testfile.rs unix | utf-8 | rust 57% 24:1 -"/tmp/testfile.rs" 42L, 285C +