aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/buffer_defs.h6
-rw-r--r--src/nvim/move.c31
-rw-r--r--src/nvim/normal.c6
-rw-r--r--src/nvim/window.c17
4 files changed, 24 insertions, 36 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index 540542f409..b72ca51517 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -1230,10 +1230,8 @@ struct window_S {
colnr_T w_skipcol; // starting column when a single line
// doesn't fit in the window
- /*
- * "w_last_topline" and "w_last_leftcol" are used to determine if
- * a Scroll autocommand should be emitted.
- */
+ // "w_last_topline" and "w_last_leftcol" are used to determine if
+ // a Scroll autocommand should be emitted.
linenr_T w_last_topline; ///< last known value for topline
colnr_T w_last_leftcol; ///< last known value for leftcol
int w_last_width; ///< last known value for width
diff --git a/src/nvim/move.c b/src/nvim/move.c
index 218dcd289d..549a135a5e 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -1020,16 +1020,12 @@ void textpos2screenpos(win_T *wp, pos_T *pos, int *rowp, int *scolp,
*ecolp = ecol + coloff;
}
-/*
- * Scroll the current window down by "line_count" logical lines. "CTRL-Y"
- */
-bool
-scrolldown (
- long line_count,
- int byfold /* true: count a closed fold as one line */
-)
+/// 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 scrolldown(long line_count, int byfold)
{
- 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. */
(void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL);
@@ -1101,14 +1097,10 @@ scrolldown (
return moved;
}
-/*
- * Scroll the current window up by "line_count" logical lines. "CTRL-E"
- */
-bool
-scrollup (
- long line_count,
- int byfold /* true: count a closed fold as one line */
-)
+/// 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 scrollup(long line_count, int byfold)
{
linenr_T topline = curwin->w_topline;
linenr_T botline = curwin->w_botline;
@@ -1156,9 +1148,8 @@ scrollup (
coladvance(curwin->w_curswant);
}
- bool moved =
- topline != curwin->w_topline ||
- botline != curwin->w_botline;
+ bool moved = topline != curwin->w_topline
+ || botline != curwin->w_botline;
return moved;
}
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index b09b99cf35..771ca732f4 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -4158,10 +4158,12 @@ void scroll_redraw(int up, long count)
curwin->w_valid |= VALID_TOPLINE;
}
}
- if (curwin->w_cursor.lnum != prev_lnum)
+ if (curwin->w_cursor.lnum != prev_lnum) {
coladvance(curwin->w_curswant);
- if (moved)
+ }
+ if (moved) {
curwin->w_viewport_invalid = true;
+ }
redraw_later(curwin, VALID);
}
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 47b6b7e713..9d918ebeb0 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -4975,20 +4975,17 @@ void shell_new_columns(void)
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)
{
- return (curwin->w_last_topline != curwin->w_topline ||
- curwin->w_last_leftcol != curwin->w_leftcol ||
- curwin->w_last_width != curwin->w_width ||
- curwin->w_last_height != curwin->w_height);
+ return (curwin->w_last_topline != curwin->w_topline
+ || curwin->w_last_leftcol != curwin->w_leftcol
+ || curwin->w_last_width != curwin->w_width
+ || curwin->w_last_height != curwin->w_height);
}
-/*
- * Trigger WinScrolled autocmd
- */
+/// Trigger WinScrolled autocmd
void do_autocmd_winscrolled(win_T *wp)
{
apply_autocmds(EVENT_WINSCROLLED, NULL, NULL, false, curbuf);