diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-07-20 19:51:32 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-07-20 19:51:32 -0400 |
commit | a63b95b315673354df9c42efcff248cacca45669 (patch) | |
tree | 474781d9dd71c62ab9377faa1641321c173f1a85 /src | |
parent | 54d9ea61ab2e7ce0d1dfdbf427b6d6702f972d74 (diff) | |
download | rneovim-a63b95b315673354df9c42efcff248cacca45669.tar.gz rneovim-a63b95b315673354df9c42efcff248cacca45669.tar.bz2 rneovim-a63b95b315673354df9c42efcff248cacca45669.zip |
move: assert nonnull wp pointer
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/move.c | 1 | ||||
-rw-r--r-- | src/nvim/screen.c | 32 |
2 files changed, 19 insertions, 14 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c index 8e44a0affc..b9c4196251 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -104,6 +104,7 @@ void reset_cursorline(void) // Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is set. void redraw_for_cursorline(win_T *wp) + FUNC_ATTR_NONNULL_ALL { if ((wp->w_p_rnu || win_cursorline_standout(wp)) && (wp->w_valid & VALID_CROW) == 0 diff --git a/src/nvim/screen.c b/src/nvim/screen.c index fd2a07e890..ab9f71ed6c 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -171,6 +171,7 @@ void redraw_later(int type) } void redraw_win_later(win_T *wp, int type) + FUNC_ATTR_NONNULL_ALL { if (!exiting && wp->w_redr_type < type) { wp->w_redr_type = type; @@ -243,6 +244,7 @@ redrawWinline( win_T *wp, linenr_T lnum ) + FUNC_ATTR_NONNULL_ALL { if (lnum >= wp->w_topline && lnum < wp->w_botline) { @@ -518,26 +520,27 @@ int update_screen(int type) return OK; } -/* - * Return TRUE if the cursor line in window "wp" may be concealed, according - * to the 'concealcursor' option. - */ -int conceal_cursor_line(win_T *wp) +// Return true if the cursor line in window "wp" may be concealed, according +// to the 'concealcursor' option. +bool conceal_cursor_line(const win_T *wp) + FUNC_ATTR_NONNULL_ALL { int c; - if (*wp->w_p_cocu == NUL) - return FALSE; - if (get_real_state() & VISUAL) + if (*wp->w_p_cocu == NUL) { + return false; + } + if (get_real_state() & VISUAL) { c = 'v'; - else if (State & INSERT) + } else if (State & INSERT) { c = 'i'; - else if (State & NORMAL) + } else if (State & NORMAL) { c = 'n'; - else if (State & CMDLINE) + } else if (State & CMDLINE) { c = 'c'; - else - return FALSE; + } else { + return false; + } return vim_strchr(wp->w_p_cocu, c) != NULL; } @@ -559,7 +562,8 @@ void conceal_check_cursor_line(void) /// /// If true, both old and new cursorline will need /// need to be redrawn when moving cursor within windows. -bool win_cursorline_standout(win_T *wp) +bool win_cursorline_standout(const win_T *wp) + FUNC_ATTR_NONNULL_ALL { return wp->w_p_cul || (wp->w_p_cole > 0 && !conceal_cursor_line(wp)); } |