move: assert nonnull wp pointer

This commit is contained in:
Jan Edmund Lazo 2019-07-20 19:51:32 -04:00
parent 54d9ea61ab
commit a63b95b315
2 changed files with 19 additions and 14 deletions

View File

@ -104,6 +104,7 @@ void reset_cursorline(void)
// Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is set. // Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is set.
void redraw_for_cursorline(win_T *wp) void redraw_for_cursorline(win_T *wp)
FUNC_ATTR_NONNULL_ALL
{ {
if ((wp->w_p_rnu || win_cursorline_standout(wp)) if ((wp->w_p_rnu || win_cursorline_standout(wp))
&& (wp->w_valid & VALID_CROW) == 0 && (wp->w_valid & VALID_CROW) == 0

View File

@ -171,6 +171,7 @@ void redraw_later(int type)
} }
void redraw_win_later(win_T *wp, int type) void redraw_win_later(win_T *wp, int type)
FUNC_ATTR_NONNULL_ALL
{ {
if (!exiting && wp->w_redr_type < type) { if (!exiting && wp->w_redr_type < type) {
wp->w_redr_type = type; wp->w_redr_type = type;
@ -243,6 +244,7 @@ redrawWinline(
win_T *wp, win_T *wp,
linenr_T lnum linenr_T lnum
) )
FUNC_ATTR_NONNULL_ALL
{ {
if (lnum >= wp->w_topline if (lnum >= wp->w_topline
&& lnum < wp->w_botline) { && lnum < wp->w_botline) {
@ -518,26 +520,27 @@ int update_screen(int type)
return OK; return OK;
} }
/* // Return true if the cursor line in window "wp" may be concealed, according
* Return TRUE if the cursor line in window "wp" may be concealed, according // to the 'concealcursor' option.
* to the 'concealcursor' option. bool conceal_cursor_line(const win_T *wp)
*/ FUNC_ATTR_NONNULL_ALL
int conceal_cursor_line(win_T *wp)
{ {
int c; int c;
if (*wp->w_p_cocu == NUL) if (*wp->w_p_cocu == NUL) {
return FALSE; return false;
if (get_real_state() & VISUAL) }
if (get_real_state() & VISUAL) {
c = 'v'; c = 'v';
else if (State & INSERT) } else if (State & INSERT) {
c = 'i'; c = 'i';
else if (State & NORMAL) } else if (State & NORMAL) {
c = 'n'; c = 'n';
else if (State & CMDLINE) } else if (State & CMDLINE) {
c = 'c'; c = 'c';
else } else {
return FALSE; return false;
}
return vim_strchr(wp->w_p_cocu, c) != NULL; 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 /// If true, both old and new cursorline will need
/// need to be redrawn when moving cursor within windows. /// 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)); return wp->w_p_cul || (wp->w_p_cole > 0 && !conceal_cursor_line(wp));
} }