diff options
author | Peter Hodge <peter.hodge84@gmail.com> | 2018-01-26 20:36:11 +0100 |
---|---|---|
committer | KillTheMule <KillTheMule@users.noreply.github.com> | 2018-05-23 22:07:27 +0200 |
commit | edcc73e766438facc88db19000f054aa52ab8b13 (patch) | |
tree | 17a62cbbb7785e6f88aaa99728cfa0d8cd5e076c /src/nvim/ops.c | |
parent | 418abfc9d06923e96f1317419fe83ed4e6d67c1d (diff) | |
download | rneovim-edcc73e766438facc88db19000f054aa52ab8b13.tar.gz rneovim-edcc73e766438facc88db19000f054aa52ab8b13.tar.bz2 rneovim-edcc73e766438facc88db19000f054aa52ab8b13.zip |
API: Implement buffer updates
Originally written by @phodge in
https://github.com/neovim/neovim/pull/5269.
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r-- | src/nvim/ops.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index d874768dfc..692713af73 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -214,7 +214,7 @@ void op_shift(oparg_T *oap, int curs_top, int amount) ++curwin->w_cursor.lnum; } - changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L); + changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L, true); if (oap->motion_type == kMTBlockWise) { curwin->w_cursor.lnum = oap->start.lnum; @@ -570,7 +570,7 @@ static void block_insert(oparg_T *oap, char_u *s, int b_insert, struct block_def } } /* for all lnum */ - changed_lines(oap->start.lnum + 1, 0, oap->end.lnum + 1, 0L); + changed_lines(oap->start.lnum + 1, 0, oap->end.lnum + 1, 0L, true); State = oldstate; } @@ -634,8 +634,8 @@ void op_reindent(oparg_T *oap, Indenter how) * there is no change still need to remove the Visual highlighting. */ if (last_changed != 0) changed_lines(first_changed, 0, - oap->is_VIsual ? start_lnum + oap->line_count : - last_changed + 1, 0L); + oap->is_VIsual ? start_lnum + oap->line_count : + last_changed + 1, 0L, true); else if (oap->is_VIsual) redraw_curbuf_later(INVERTED); @@ -1455,7 +1455,7 @@ int op_delete(oparg_T *oap) check_cursor_col(); changed_lines(curwin->w_cursor.lnum, curwin->w_cursor.col, - oap->end.lnum + 1, 0L); + oap->end.lnum + 1, 0L, true); oap->line_count = 0; // no lines deleted } else if (oap->motion_type == kMTLineWise) { if (oap->op_type == OP_CHANGE) { @@ -1822,7 +1822,7 @@ int op_replace(oparg_T *oap, int c) curwin->w_cursor = oap->start; check_cursor(); - changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1, 0L); + changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1, 0L, true); /* Set "'[" and "']" marks. */ curbuf->b_op_start = oap->start; @@ -1857,7 +1857,7 @@ void op_tilde(oparg_T *oap) } if (did_change) - changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L); + changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L, true); } else { // not block mode if (oap->motion_type == kMTLineWise) { oap->start.col = 0; @@ -1881,7 +1881,7 @@ void op_tilde(oparg_T *oap) } if (did_change) { changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1, - 0L); + 0L, true); } } @@ -2264,7 +2264,7 @@ int op_change(oparg_T *oap) } } check_cursor(); - changed_lines(oap->start.lnum + 1, 0, oap->end.lnum + 1, 0L); + changed_lines(oap->start.lnum + 1, 0, oap->end.lnum + 1, 0L, true); xfree(ins_text); } } @@ -3033,7 +3033,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags) curwin->w_cursor.col += bd.startspaces; } - changed_lines(lnum, 0, curwin->w_cursor.lnum, nr_lines); + changed_lines(lnum, 0, curwin->w_cursor.lnum, nr_lines, true); /* Set '[ mark. */ curbuf->b_op_start = curwin->w_cursor; @@ -3210,10 +3210,10 @@ error: // note changed text for displaying and folding if (y_type == kMTCharWise) { changed_lines(curwin->w_cursor.lnum, col, - curwin->w_cursor.lnum + 1, nr_lines); + curwin->w_cursor.lnum + 1, nr_lines, true); } else { changed_lines(curbuf->b_op_start.lnum, 0, - curbuf->b_op_start.lnum, nr_lines); + curbuf->b_op_start.lnum, nr_lines, true); } /* put '] mark at last inserted character */ @@ -3693,7 +3693,7 @@ int do_join(size_t count, /* Only report the change in the first line here, del_lines() will report * the deleted line. */ changed_lines(curwin->w_cursor.lnum, currsize, - curwin->w_cursor.lnum + 1, 0L); + curwin->w_cursor.lnum + 1, 0L, true); /* * Delete following lines. To do this we move the cursor there @@ -4363,7 +4363,7 @@ void op_addsub(oparg_T *oap, linenr_T Prenum1, bool g_cmd) } change_cnt = do_addsub(oap->op_type, &pos, 0, amount); if (change_cnt) { - changed_lines(pos.lnum, 0, pos.lnum + 1, 0L); + changed_lines(pos.lnum, 0, pos.lnum + 1, 0L, true); } } else { int one_change; @@ -4419,7 +4419,7 @@ void op_addsub(oparg_T *oap, linenr_T Prenum1, bool g_cmd) } } if (change_cnt) { - changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L); + changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L, true); } if (!change_cnt && oap->is_VIsual) { |