From 672449e448e504b0ee1e4f1fea13932c90ae8211 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 7 Aug 2018 12:32:13 -0400 Subject: memline: copy in ml_replace() is bool --- src/nvim/misc1.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/nvim/misc1.c') diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index d2ecb9a74b..a312783c64 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -772,7 +772,7 @@ open_line ( (void)u_save_cursor(); /* errors are ignored! */ vr_lines_changed++; } - ml_replace(curwin->w_cursor.lnum, p_extra, TRUE); + ml_replace(curwin->w_cursor.lnum, p_extra, true); changed_bytes(curwin->w_cursor.lnum, 0); curwin->w_cursor.lnum--; did_append = FALSE; @@ -832,12 +832,13 @@ open_line ( if (dir == FORWARD) { if (trunc_line || (State & INSERT)) { - /* truncate current line at cursor */ + // truncate current line at cursor saved_line[curwin->w_cursor.col] = NUL; - /* Remove trailing white space, unless OPENLINE_KEEPTRAIL used. */ - if (trunc_line && !(flags & OPENLINE_KEEPTRAIL)) + // Remove trailing white space, unless OPENLINE_KEEPTRAIL used. + if (trunc_line && !(flags & OPENLINE_KEEPTRAIL)) { truncate_spaces(saved_line); - ml_replace(curwin->w_cursor.lnum, saved_line, FALSE); + } + ml_replace(curwin->w_cursor.lnum, saved_line, false); saved_line = NULL; if (did_append) { changed_lines(curwin->w_cursor.lnum, curwin->w_cursor.col, @@ -913,8 +914,8 @@ open_line ( /* Put new line in p_extra */ p_extra = vim_strsave(get_cursor_line_ptr()); - /* Put back original line */ - ml_replace(curwin->w_cursor.lnum, next_line, FALSE); + // Put back original line + ml_replace(curwin->w_cursor.lnum, next_line, false); /* Insert new stuff into line again */ curwin->w_cursor.col = 0; @@ -1498,8 +1499,8 @@ void ins_char_bytes(char_u *buf, size_t charlen) p[i] = ' '; } - /* Replace the line in the buffer. */ - ml_replace(lnum, newp, FALSE); + // Replace the line in the buffer. + ml_replace(lnum, newp, false); // mark the buffer as changed and prepare for displaying changed_bytes(lnum, (colnr_T)col); @@ -1549,7 +1550,7 @@ void ins_str(char_u *s) memmove(newp, oldp, (size_t)col); memmove(newp + col, s, (size_t)newlen); memmove(newp + col + newlen, oldp + col, (size_t)(oldlen - col + 1)); - ml_replace(lnum, newp, FALSE); + ml_replace(lnum, newp, false); changed_bytes(lnum, col); curwin->w_cursor.col += newlen; } @@ -1667,8 +1668,9 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine) memmove(newp, oldp, (size_t)col); } memmove(newp + col, oldp + col + count, (size_t)movelen); - if (!was_alloced) - ml_replace(lnum, newp, FALSE); + if (!was_alloced) { + ml_replace(lnum, newp, false); + } /* mark the buffer as changed and prepare for displaying */ changed_bytes(lnum, curwin->w_cursor.col); -- cgit From d5e8b3f451120d7b40d72b54d749fbe7b54ca90f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 7 Aug 2018 19:07:54 -0400 Subject: misc: fixpos in del_char() is bool --- src/nvim/misc1.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/nvim/misc1.c') diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index a312783c64..e04d84ffc8 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -1555,14 +1555,12 @@ void ins_str(char_u *s) curwin->w_cursor.col += newlen; } -/* - * Delete one character under the cursor. - * If "fixpos" is TRUE, don't leave the cursor on the NUL after the line. - * Caller must have prepared for undo. - * - * return FAIL for failure, OK otherwise - */ -int del_char(int fixpos) +// Delete one character under the cursor. +// If "fixpos" is true, don't leave the cursor on the NUL after the line. +// Caller must have prepared for undo. +// +// return FAIL for failure, OK otherwise +int del_char(bool fixpos) { if (has_mbyte) { /* Make sure the cursor is at the start of a character. */ -- cgit