Merge pull request #13842 from vigoux/update-last-line

fix(buf_updates): send updates when putting past last line
This commit is contained in:
Björn Linse 2021-02-08 20:29:59 +01:00 committed by GitHub
commit 38ea2ce342
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 9 deletions

View File

@ -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) {

View File

@ -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