diff options
-rw-r--r-- | src/nvim/diff.c | 2 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 3 | ||||
-rw-r--r-- | src/nvim/indent.c | 6 | ||||
-rw-r--r-- | src/nvim/normal.c | 18 | ||||
-rw-r--r-- | src/nvim/screen.c | 55 |
5 files changed, 38 insertions, 46 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c index e0cd285667..866161e5cf 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -1542,7 +1542,7 @@ static void diff_read(int idx_orig, int idx_new, diffout_T *dout) } else if ((STRNCMP(line, "@@ ", 3) == 0)) { diffstyle = DIFF_UNIFIED; } else if ((STRNCMP(line, "--- ", 4) == 0) - && (vim_fgets(linebuf, LBUFLEN, fd) == 0) + && (vim_fgets(linebuf, LBUFLEN, fd) == 0) // -V501 && (STRNCMP(line, "+++ ", 4) == 0) && (vim_fgets(linebuf, LBUFLEN, fd) == 0) // -V501 && (STRNCMP(line, "@@ ", 3) == 0)) { diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index bfc32887ca..4ea25117d9 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -6197,9 +6197,6 @@ static int open_cmdwin(void) stuffReadbuff(p); stuffcharReadbuff(CAR); } - } else if (cmdwin_result == K_XF2) { /* :qa typed */ - ccline.cmdbuff = vim_strsave((char_u *)"qa"); - cmdwin_result = CAR; } else if (cmdwin_result == Ctrl_C) { /* :q or :close, don't execute any command * and don't modify the cmd window. */ diff --git a/src/nvim/indent.c b/src/nvim/indent.c index 0b7ebd498a..7c3f354c13 100644 --- a/src/nvim/indent.c +++ b/src/nvim/indent.c @@ -544,10 +544,8 @@ int get_expr_indent(void) // Need to make a copy, the 'indentexpr' option could be changed while // evaluating it. char_u *inde_copy = vim_strsave(curbuf->b_p_inde); - if (inde_copy != NULL) { - indent = (int)eval_to_number(inde_copy); - xfree(inde_copy); - } + indent = (int)eval_to_number(inde_copy); + xfree(inde_copy); if (use_sandbox) { sandbox--; diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 462b476a35..705dea4e88 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -1,11 +1,11 @@ // This is an open source non-commercial project. Dear PVS-Studio, please check // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com -/* - * normal.c: Contains the main routine for processing characters in command - * mode. Communicates closely with the code in ops.c to handle - * the operators. - */ +// +// normal.c: Contains the main routine for processing characters in command +// mode. Communicates closely with the code in ops.c to handle +// the operators. +// #include <assert.h> #include <inttypes.h> @@ -3939,9 +3939,11 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist) (void)hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL); linelen = linetabsize(get_cursor_line_ptr()); - if (linelen > width1) - curwin->w_curswant += (((linelen - width1 - 1) / width2) - + 1) * width2; + if (linelen > width1) { + int w = (((linelen - width1 - 1) / width2) + 1) * width2; + assert(curwin->w_curswant <= INT_MAX - w); + curwin->w_curswant += w; + } } } else { /* dir == FORWARD */ if (linelen > width1) diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 5166bc2e42..98b0378b18 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -477,6 +477,25 @@ void update_screen(int type) } +// Prepare for updating one or more windows. +// Caller must check for "updating_screen" already set to avoid recursiveness. +static void update_prepare(void) +{ + updating_screen = true; + start_search_hl(); +} + +// Finish updating one or more windows. +static void update_finish(void) +{ + if (redraw_cmdline) { + showmode(); + } + + end_search_hl(); + updating_screen = false; +} + /* * Return TRUE if the cursor line in window "wp" may be concealed, according * to the 'concealcursor' option. @@ -522,52 +541,28 @@ void update_single_line(win_T *wp, linenr_T lnum) if (linebuf_char == NULL || updating_screen) { return; } - updating_screen = true; if (lnum >= wp->w_topline && lnum < wp->w_botline && foldedCount(wp, lnum, &win_foldinfo) == 0) { + update_prepare(); + row = 0; for (j = 0; j < wp->w_lines_valid; ++j) { if (lnum == wp->w_lines[j].wl_lnum) { init_search_hl(wp); - start_search_hl(); prepare_search_hl(wp, lnum); update_window_hl(wp, false); // allocate window grid if not already win_grid_alloc(wp); win_line(wp, lnum, row, row + wp->w_lines[j].wl_size, false, false); - end_search_hl(); break; } row += wp->w_lines[j].wl_size; } + + update_finish(); } need_cursor_line_redraw = false; - updating_screen = false; -} - - -/* - * Prepare for updating one or more windows. - * Caller must check for "updating_screen" already set to avoid recursiveness. - */ -static void update_prepare(void) -{ - updating_screen = TRUE; - start_search_hl(); -} - -/* - * Finish updating one or more windows. - */ -static void update_finish(void) -{ - if (redraw_cmdline) { - showmode(); - } - - end_search_hl(); - updating_screen = FALSE; } void update_debug_sign(const buf_T *const buf, const linenr_T lnum) @@ -2941,8 +2936,8 @@ win_line ( break; } - if (draw_state == WL_LINE && area_highlighting) { - /* handle Visual or match highlighting in this line */ + if (draw_state == WL_LINE && (area_highlighting || has_spell)) { + // handle Visual or match highlighting in this line if (vcol == fromcol || (vcol + 1 == fromcol && n_extra == 0 && utf_ptr2cells(ptr) > 1) |