aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/ops.c14
-rw-r--r--test/functional/lua/buffer_updates_spec.lua14
2 files changed, 19 insertions, 9 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 87d092281a..ea52d6a3d3 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -3422,15 +3422,11 @@ error:
if (dir == FORWARD)
curbuf->b_op_start.lnum++;
}
- // Skip mark_adjust when adding lines after the last one, there
- // can't be marks there.
- if (curbuf->b_op_start.lnum + (y_type == kMTCharWise) - 1 + nr_lines
- < curbuf->b_ml.ml_line_count) {
- ExtmarkOp kind = (y_type == kMTLineWise && !(flags & PUT_LINE_SPLIT))
- ? kExtmarkUndo : kExtmarkNOOP;
- mark_adjust(curbuf->b_op_start.lnum + (y_type == kMTCharWise),
- (linenr_T)MAXLNUM, nr_lines, 0L, kind);
- }
+
+ ExtmarkOp kind = (y_type == kMTLineWise && !(flags & PUT_LINE_SPLIT))
+ ? kExtmarkUndo : kExtmarkNOOP;
+ mark_adjust(curbuf->b_op_start.lnum + (y_type == kMTCharWise),
+ (linenr_T)MAXLNUM, nr_lines, 0L, kind);
// note changed text for displaying and folding
if (y_type == kMTCharWise) {
diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua
index 6087f9e7d6..6c2615eebd 100644
--- a/test/functional/lua/buffer_updates_spec.lua
+++ b/test/functional/lua/buffer_updates_spec.lua
@@ -507,6 +507,20 @@ describe('lua: nvim_buf_attach on_bytes', function()
end)
+ it("linewise paste", function()
+ local check_events = setup_eventcheck(verify, origlines)
+
+ feed'yyp'
+ check_events {
+ { "test1", "bytes", 1, 3, 1, 0, 16, 0, 0, 0, 1, 0, 16 };
+ }
+
+ feed'Gyyp'
+ check_events {
+ { "test1", "bytes", 1, 4, 8, 0, 130, 0, 0, 0, 1, 0, 18 };
+ }
+ end)
+
it('inccomand=nosplit and substitute', function()
if verify then pending("Verification can't be done when previewing") end