From f5c56f03bb9ee25c3d931034497dc76a5591b770 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Wed, 29 May 2019 10:05:00 +0200 Subject: api: allow nvim_buf_attach from lua using callbacks --- src/nvim/fold.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'src/nvim/fold.c') diff --git a/src/nvim/fold.c b/src/nvim/fold.c index 39975308d7..72d8c14468 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -737,15 +737,13 @@ void deleteFold( changed_lines(first_lnum, (colnr_T)0, last_lnum, 0L, false); // send one nvim_buf_lines_event at the end - if (kv_size(curbuf->update_channels)) { - // last_lnum is the line *after* the last line of the outermost fold - // that was modified. Note also that deleting a fold might only require - // the modification of the *first* line of the fold, but we send through a - // notification that includes every line that was part of the fold - int64_t num_changed = last_lnum - first_lnum; - buf_updates_send_changes(curbuf, first_lnum, num_changed, - num_changed, true); - } + // last_lnum is the line *after* the last line of the outermost fold + // that was modified. Note also that deleting a fold might only require + // the modification of the *first* line of the fold, but we send through a + // notification that includes every line that was part of the fold + int64_t num_changed = last_lnum - first_lnum; + buf_updates_send_changes(curbuf, first_lnum, num_changed, + num_changed, true); } } @@ -1584,13 +1582,11 @@ static void foldCreateMarkers(linenr_T start, linenr_T end) * changed when the start marker is inserted and the end isn't. */ changed_lines(start, (colnr_T)0, end, 0L, false); - if (kv_size(curbuf->update_channels)) { - // Note: foldAddMarker() may not actually change start and/or end if - // u_save() is unable to save the buffer line, but we send the - // nvim_buf_lines_event anyway since it won't do any harm. - int64_t num_changed = 1 + end - start; - buf_updates_send_changes(curbuf, start, num_changed, num_changed, true); - } + // Note: foldAddMarker() may not actually change start and/or end if + // u_save() is unable to save the buffer line, but we send the + // nvim_buf_lines_event anyway since it won't do any harm. + int64_t num_changed = 1 + end - start; + buf_updates_send_changes(curbuf, start, num_changed, num_changed, true); } /* foldAddMarker() {{{2 */ -- cgit