my fight with the linter

This commit is contained in:
Rom Grk
2020-11-06 20:06:40 -05:00
parent 13e0ca3e19
commit 4ed6f69497
4 changed files with 24 additions and 36 deletions

View File

@@ -1230,10 +1230,8 @@ struct window_S {
colnr_T w_skipcol; // starting column when a single line colnr_T w_skipcol; // starting column when a single line
// doesn't fit in the window // doesn't fit in the window
/* // "w_last_topline" and "w_last_leftcol" are used to determine if
* "w_last_topline" and "w_last_leftcol" are used to determine if // a Scroll autocommand should be emitted.
* a Scroll autocommand should be emitted.
*/
linenr_T w_last_topline; ///< last known value for topline linenr_T w_last_topline; ///< last known value for topline
colnr_T w_last_leftcol; ///< last known value for leftcol colnr_T w_last_leftcol; ///< last known value for leftcol
int w_last_width; ///< last known value for width int w_last_width; ///< last known value for width

View File

@@ -1020,16 +1020,12 @@ void textpos2screenpos(win_T *wp, pos_T *pos, int *rowp, int *scolp,
*ecolp = ecol + coloff; *ecolp = ecol + coloff;
} }
/* /// Scroll the current window down by "line_count" logical lines. "CTRL-Y"
* Scroll the current window down by "line_count" logical lines. "CTRL-Y" /// @param line_count number of lines to scroll
*/ /// @param byfold if true, count a closed fold as one line
bool bool scrolldown(long line_count, int byfold)
scrolldown (
long line_count,
int byfold /* true: count a closed fold as one line */
)
{ {
int done = 0; /* total # of physical lines done */ int done = 0; // total # of physical lines done
/* Make sure w_topline is at the first of a sequence of folded lines. */ /* Make sure w_topline is at the first of a sequence of folded lines. */
(void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL); (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL);
@@ -1101,14 +1097,10 @@ scrolldown (
return moved; return moved;
} }
/* /// Scroll the current window up by "line_count" logical lines. "CTRL-E"
* Scroll the current window up by "line_count" logical lines. "CTRL-E" /// @param line_count number of lines to scroll
*/ /// @param byfold if true, count a closed fold as one line
bool bool scrollup(long line_count, int byfold)
scrollup (
long line_count,
int byfold /* true: count a closed fold as one line */
)
{ {
linenr_T topline = curwin->w_topline; linenr_T topline = curwin->w_topline;
linenr_T botline = curwin->w_botline; linenr_T botline = curwin->w_botline;
@@ -1156,9 +1148,8 @@ scrollup (
coladvance(curwin->w_curswant); coladvance(curwin->w_curswant);
} }
bool moved = bool moved = topline != curwin->w_topline
topline != curwin->w_topline || || botline != curwin->w_botline;
botline != curwin->w_botline;
return moved; return moved;
} }

View File

@@ -4158,10 +4158,12 @@ void scroll_redraw(int up, long count)
curwin->w_valid |= VALID_TOPLINE; curwin->w_valid |= VALID_TOPLINE;
} }
} }
if (curwin->w_cursor.lnum != prev_lnum) if (curwin->w_cursor.lnum != prev_lnum) {
coladvance(curwin->w_curswant); coladvance(curwin->w_curswant);
if (moved) }
if (moved) {
curwin->w_viewport_invalid = true; curwin->w_viewport_invalid = true;
}
redraw_later(curwin, VALID); redraw_later(curwin, VALID);
} }

View File

@@ -4975,20 +4975,17 @@ void shell_new_columns(void)
win_reconfig_floats(); // The size of floats might change win_reconfig_floats(); // The size of floats might change
} }
/* /// Check if "wp" has scrolled since last time it was checked
* Check if "wp" has scrolled since last time it was checked /// @param wp the window to check
*/
bool win_did_scroll(win_T *wp) bool win_did_scroll(win_T *wp)
{ {
return (curwin->w_last_topline != curwin->w_topline || return (curwin->w_last_topline != curwin->w_topline
curwin->w_last_leftcol != curwin->w_leftcol || || curwin->w_last_leftcol != curwin->w_leftcol
curwin->w_last_width != curwin->w_width || || curwin->w_last_width != curwin->w_width
curwin->w_last_height != curwin->w_height); || curwin->w_last_height != curwin->w_height);
} }
/* /// Trigger WinScrolled autocmd
* Trigger WinScrolled autocmd
*/
void do_autocmd_winscrolled(win_T *wp) void do_autocmd_winscrolled(win_T *wp)
{ {
apply_autocmds(EVENT_WINSCROLLED, NULL, NULL, false, curbuf); apply_autocmds(EVENT_WINSCROLLED, NULL, NULL, false, curbuf);