diff options
author | Daniel Hahler <git@thequod.de> | 2019-06-10 15:06:37 +0200 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2019-08-07 14:21:23 +0200 |
commit | f7fac33a1f3a58c2e4337950e2cf133347ebfd04 (patch) | |
tree | 693071e6eef1c77b753c59036c4c2fc308537773 /src | |
parent | 41fa6079b268dcf52bda85d8ebd87313c0ef4164 (diff) | |
download | rneovim-f7fac33a1f3a58c2e4337950e2cf133347ebfd04.tar.gz rneovim-f7fac33a1f3a58c2e4337950e2cf133347ebfd04.tar.bz2 rneovim-f7fac33a1f3a58c2e4337950e2cf133347ebfd04.zip |
move del_lines
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/change.c | 51 | ||||
-rw-r--r-- | src/nvim/misc1.c | 41 |
2 files changed, 26 insertions, 66 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c index 96497dbf0f..f4e4b75888 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -1777,37 +1777,38 @@ void truncate_line(int fixpos) * Delete "nlines" lines at the cursor. * Saves the lines for undo first if "undo" is TRUE. */ - void -del_lines(long nlines, int undo) +void del_lines ( + long nlines, /* number of lines to delete */ + int undo /* if TRUE, prepare for undo */ +) { - long n; - linenr_T first = curwin->w_cursor.lnum; + long n; + linenr_T first = curwin->w_cursor.lnum; - if (nlines <= 0) - return; + if (nlines <= 0) + return; - // save the deleted lines for undo - if (undo && u_savedel(first, nlines) == FAIL) - return; + /* save the deleted lines for undo */ + if (undo && u_savedel(first, nlines) == FAIL) + return; - for (n = 0; n < nlines; ) - { - if (curbuf->b_ml.ml_flags & ML_EMPTY) // nothing to delete - break; + for (n = 0; n < nlines; ) { + if (curbuf->b_ml.ml_flags & ML_EMPTY) /* nothing to delete */ + break; - ml_delete(first, TRUE); - ++n; + ml_delete(first, true); + n++; - // If we delete the last line in the file, stop - if (first > curbuf->b_ml.ml_line_count) - break; - } + /* If we delete the last line in the file, stop */ + if (first > curbuf->b_ml.ml_line_count) + break; + } - // Correct the cursor position before calling deleted_lines_mark(), it may - // trigger a callback to display the cursor. - curwin->w_cursor.col = 0; - check_cursor_lnum(); + /* Correct the cursor position before calling deleted_lines_mark(), it may + * trigger a callback to display the cursor. */ + curwin->w_cursor.col = 0; + check_cursor_lnum(); - // adjust marks, mark the buffer as changed and prepare for displaying - deleted_lines_mark(first, n); + /* adjust marks, mark the buffer as changed and prepare for displaying */ + deleted_lines_mark(first, n); } diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 5cd2f778a0..19b8165843 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -525,47 +525,6 @@ void ins_char(int c) ins_char_bytes(buf, n); } -/* - * Delete "nlines" lines at the cursor. - * Saves the lines for undo first if "undo" is TRUE. - */ -void -del_lines ( - long nlines, /* number of lines to delete */ - int undo /* if TRUE, prepare for undo */ -) -{ - long n; - linenr_T first = curwin->w_cursor.lnum; - - if (nlines <= 0) - return; - - /* save the deleted lines for undo */ - if (undo && u_savedel(first, nlines) == FAIL) - return; - - for (n = 0; n < nlines; ) { - if (curbuf->b_ml.ml_flags & ML_EMPTY) /* nothing to delete */ - break; - - ml_delete(first, true); - n++; - - /* If we delete the last line in the file, stop */ - if (first > curbuf->b_ml.ml_line_count) - break; - } - - /* Correct the cursor position before calling deleted_lines_mark(), it may - * trigger a callback to display the cursor. */ - curwin->w_cursor.col = 0; - check_cursor_lnum(); - - /* adjust marks, mark the buffer as changed and prepare for displaying */ - deleted_lines_mark(first, n); -} - int gchar_pos(pos_T *pos) FUNC_ATTR_NONNULL_ARG(1) { |