mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
fold: add const to foldMoveTo() variables
Declare and initialize variables on same line if possible.
This commit is contained in:
@@ -822,42 +822,34 @@ void foldUpdateAll(win_T *win)
|
|||||||
redraw_win_later(win, NOT_VALID);
|
redraw_win_later(win, NOT_VALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* foldMoveTo() {{{2 */
|
// foldMoveTo() {{{2
|
||||||
/*
|
//
|
||||||
* If "updown" is FALSE: Move to the start or end of the fold.
|
// If "updown" is false: Move to the start or end of the fold.
|
||||||
* If "updown" is TRUE: move to fold at the same level.
|
// If "updown" is true: move to fold at the same level.
|
||||||
* If not moved return FAIL.
|
// If not moved return FAIL.
|
||||||
*/
|
int foldMoveTo(
|
||||||
int
|
const bool updown,
|
||||||
foldMoveTo(
|
const int dir, // FORWARD or BACKWARD
|
||||||
int updown,
|
const long count
|
||||||
int dir, // FORWARD or BACKWARD
|
|
||||||
long count
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
long n;
|
|
||||||
int retval = FAIL;
|
int retval = FAIL;
|
||||||
linenr_T lnum_off;
|
|
||||||
linenr_T lnum_found;
|
|
||||||
linenr_T lnum;
|
linenr_T lnum;
|
||||||
garray_T *gap;
|
|
||||||
fold_T *fp;
|
fold_T *fp;
|
||||||
int level;
|
|
||||||
int last;
|
|
||||||
|
|
||||||
checkupdate(curwin);
|
checkupdate(curwin);
|
||||||
|
|
||||||
/* Repeat "count" times. */
|
// Repeat "count" times.
|
||||||
for (n = 0; n < count; ++n) {
|
for (long n = 0; n < count; n++) {
|
||||||
/* Find nested folds. Stop when a fold is closed. The deepest fold
|
// Find nested folds. Stop when a fold is closed. The deepest fold
|
||||||
* that moves the cursor is used. */
|
// that moves the cursor is used.
|
||||||
lnum_off = 0;
|
linenr_T lnum_off = 0;
|
||||||
gap = &curwin->w_folds;
|
garray_T *gap = &curwin->w_folds;
|
||||||
bool use_level = false;
|
bool use_level = false;
|
||||||
bool maybe_small = false;
|
bool maybe_small = false;
|
||||||
lnum_found = curwin->w_cursor.lnum;
|
linenr_T lnum_found = curwin->w_cursor.lnum;
|
||||||
level = 0;
|
int level = 0;
|
||||||
last = FALSE;
|
bool last = false;
|
||||||
for (;; ) {
|
for (;; ) {
|
||||||
if (!foldFind(gap, curwin->w_cursor.lnum - lnum_off, &fp)) {
|
if (!foldFind(gap, curwin->w_cursor.lnum - lnum_off, &fp)) {
|
||||||
if (!updown)
|
if (!updown)
|
||||||
@@ -875,14 +867,15 @@ foldMoveTo(
|
|||||||
}
|
}
|
||||||
/* don't look for contained folds, they will always move
|
/* don't look for contained folds, they will always move
|
||||||
* the cursor too far. */
|
* the cursor too far. */
|
||||||
last = TRUE;
|
last = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!last) {
|
if (!last) {
|
||||||
/* Check if this fold is closed. */
|
/* Check if this fold is closed. */
|
||||||
if (check_closed(curwin, fp, &use_level, level,
|
if (check_closed(curwin, fp, &use_level, level,
|
||||||
&maybe_small, lnum_off))
|
&maybe_small, lnum_off)) {
|
||||||
last = TRUE;
|
last = true;
|
||||||
|
}
|
||||||
|
|
||||||
/* "[z" and "]z" stop at closed fold */
|
/* "[z" and "]z" stop at closed fold */
|
||||||
if (last && !updown)
|
if (last && !updown)
|
||||||
|
Reference in New Issue
Block a user