Skip to content

Commit

Permalink
move: assert nonnull wp pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
janlazo committed Jul 20, 2019
1 parent 54d9ea6 commit a63b95b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/nvim/move.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 18 additions & 14 deletions src/nvim/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -243,6 +244,7 @@ redrawWinline(
win_T *wp,
linenr_T lnum
)
FUNC_ATTR_NONNULL_ALL
{
if (lnum >= wp->w_topline
&& lnum < wp->w_botline) {
Expand Down Expand Up @@ -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;
}

Expand All @@ -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));
}
Expand Down

0 comments on commit a63b95b

Please sign in to comment.