diff options
author | Daniel Hahler <git@thequod.de> | 2019-06-09 18:57:23 +0200 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2019-08-07 14:21:23 +0200 |
commit | b353d8599b7e105809d529f0707837b155a51abd (patch) | |
tree | e4e2fa68a6f3274cac08614cb04c22d1c33f022e /src | |
parent | 83d35e62f29aceebe3ccff961faef5a966aa8807 (diff) | |
download | rneovim-b353d8599b7e105809d529f0707837b155a51abd.tar.gz rneovim-b353d8599b7e105809d529f0707837b155a51abd.tar.bz2 rneovim-b353d8599b7e105809d529f0707837b155a51abd.zip |
move deleted_lines, deleted_lines_mark, changed_lines_buf
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/change.c | 70 | ||||
-rw-r--r-- | src/nvim/misc1.c | 51 |
2 files changed, 31 insertions, 90 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c index b430f220d9..57619e7e09 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -356,10 +356,9 @@ void appended_lines_mark(linenr_T lnum, long count) * Must be called AFTER the change and after mark_adjust(). * Takes care of marking the buffer to be redrawn and sets the changed flag. */ - void -deleted_lines(linenr_T lnum, long count) +void deleted_lines(linenr_T lnum, long count) { - changed_lines(lnum, 0, lnum + count, -count); + changed_lines(lnum, 0, lnum + count, -count, true); } /* @@ -367,47 +366,40 @@ deleted_lines(linenr_T lnum, long count) * Make sure the cursor is on a valid line before calling, a GUI callback may * be triggered to display the cursor. */ - void -deleted_lines_mark(linenr_T lnum, long count) +void deleted_lines_mark(linenr_T lnum, long count) { - mark_adjust(lnum, (linenr_T)(lnum + count - 1), (long)MAXLNUM, -count); - changed_lines(lnum, 0, lnum + count, -count); + mark_adjust(lnum, (linenr_T)(lnum + count - 1), (long)MAXLNUM, -count, false); + changed_lines(lnum, 0, lnum + count, -count, true); } -/* - * Marks the area to be redrawn after a change. - */ - static void -changed_lines_buf( - buf_T *buf, - linenr_T lnum, // first line with change - linenr_T lnume, // line below last changed line - long xtra) // number of extra lines (negative when deleting) +/// Marks the area to be redrawn after a change. +/// +/// @param buf the buffer where lines were changed +/// @param lnum first line with change +/// @param lnume line below last changed line +/// @param xtra number of extra lines (negative when deleting) +void changed_lines_buf(buf_T *buf, linenr_T lnum, linenr_T lnume, long xtra) { - if (buf->b_mod_set) - { - // find the maximum area that must be redisplayed - if (lnum < buf->b_mod_top) - buf->b_mod_top = lnum; - if (lnum < buf->b_mod_bot) - { - // adjust old bot position for xtra lines - buf->b_mod_bot += xtra; - if (buf->b_mod_bot < lnum) - buf->b_mod_bot = lnum; - } - if (lnume + xtra > buf->b_mod_bot) - buf->b_mod_bot = lnume + xtra; - buf->b_mod_xlines += xtra; - } - else - { - // set the area that must be redisplayed - buf->b_mod_set = TRUE; - buf->b_mod_top = lnum; - buf->b_mod_bot = lnume + xtra; - buf->b_mod_xlines = xtra; + if (buf->b_mod_set) { + // find the maximum area that must be redisplayed + if (lnum < buf->b_mod_top) + buf->b_mod_top = lnum; + if (lnum < buf->b_mod_bot) { + // adjust old bot position for xtra lines + buf->b_mod_bot += xtra; + if (buf->b_mod_bot < lnum) + buf->b_mod_bot = lnum; } + if (lnume + xtra > buf->b_mod_bot) + buf->b_mod_bot = lnume + xtra; + buf->b_mod_xlines += xtra; + } else { + // set the area that must be redisplayed + buf->b_mod_set = true; + buf->b_mod_top = lnum; + buf->b_mod_bot = lnume + xtra; + buf->b_mod_xlines = xtra; + } } /* diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 9a4a01c0eb..21cce61853 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -1786,27 +1786,6 @@ int gchar_pos(pos_T *pos) } /* - * Deleted "count" lines at line "lnum" in the current buffer. - * Must be called AFTER the change and after mark_adjust(). - * Takes care of marking the buffer to be redrawn and sets the changed flag. - */ -void deleted_lines(linenr_T lnum, long count) -{ - changed_lines(lnum, 0, lnum + count, -count, true); -} - -/* - * Like deleted_lines(), but adjust marks first. - * Make sure the cursor is on a valid line before calling, a GUI callback may - * be triggered to display the cursor. - */ -void deleted_lines_mark(linenr_T lnum, long count) -{ - mark_adjust(lnum, (linenr_T)(lnum + count - 1), (long)MAXLNUM, -count, false); - changed_lines(lnum, 0, lnum + count, -count, true); -} - -/* * Changed lines for the current buffer. * Must be called AFTER the change and after mark_adjust(). * - mark the buffer changed by calling changed() @@ -1859,36 +1838,6 @@ changed_lines( } } -/// Mark line range in buffer as changed. -/// -/// @param buf the buffer where lines were changed -/// @param lnum first line with change -/// @param lnume line below last changed line -/// @param xtra number of extra lines (negative when deleting) -void changed_lines_buf(buf_T *buf, linenr_T lnum, linenr_T lnume, long xtra) -{ - if (buf->b_mod_set) { - /* find the maximum area that must be redisplayed */ - if (lnum < buf->b_mod_top) - buf->b_mod_top = lnum; - if (lnum < buf->b_mod_bot) { - /* adjust old bot position for xtra lines */ - buf->b_mod_bot += xtra; - if (buf->b_mod_bot < lnum) - buf->b_mod_bot = lnum; - } - if (lnume + xtra > buf->b_mod_bot) - buf->b_mod_bot = lnume + xtra; - buf->b_mod_xlines += xtra; - } else { - /* set the area that must be redisplayed */ - buf->b_mod_set = true; - buf->b_mod_top = lnum; - buf->b_mod_bot = lnume + xtra; - buf->b_mod_xlines = xtra; - } -} - /* * unchanged() is called when the changed flag must be reset for buffer 'buf' */ |