aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fold.c
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2023-12-16 22:14:28 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2023-12-18 16:22:13 +0100
commit6cb78e2d1c4c6c63c628c965076a07ce5f7adbb6 (patch)
tree20bfbe8b317fde86121fcf9af10975b2b95e5758 /src/nvim/fold.c
parent8c173cec295cf8c78bdbc440dc87f0473560f69a (diff)
downloadrneovim-6cb78e2d1c4c6c63c628c965076a07ce5f7adbb6.tar.gz
rneovim-6cb78e2d1c4c6c63c628c965076a07ce5f7adbb6.tar.bz2
rneovim-6cb78e2d1c4c6c63c628c965076a07ce5f7adbb6.zip
docs: add style rule regarding initialization
Specifically, specify that each initialization should be done on a separate line.
Diffstat (limited to 'src/nvim/fold.c')
-rw-r--r--src/nvim/fold.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index e372b9f461..9e90ab9439 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -849,7 +849,6 @@ void foldUpdateAll(win_T *win)
int foldMoveTo(const bool updown, const int dir, const int count)
{
int retval = FAIL;
- linenr_T lnum;
fold_T *fp;
checkupdate(curwin);
@@ -908,7 +907,7 @@ int foldMoveTo(const bool updown, const int dir, const int count)
if (dir == FORWARD) {
// to start of next fold if there is one
if (fp + 1 - (fold_T *)gap->ga_data < gap->ga_len) {
- lnum = fp[1].fd_top + lnum_off;
+ linenr_T lnum = fp[1].fd_top + lnum_off;
if (lnum > curwin->w_cursor.lnum) {
lnum_found = lnum;
}
@@ -916,7 +915,7 @@ int foldMoveTo(const bool updown, const int dir, const int count)
} else {
// to end of previous fold if there is one
if (fp > (fold_T *)gap->ga_data) {
- lnum = fp[-1].fd_top + lnum_off + fp[-1].fd_len - 1;
+ linenr_T lnum = fp[-1].fd_top + lnum_off + fp[-1].fd_len - 1;
if (lnum < curwin->w_cursor.lnum) {
lnum_found = lnum;
}
@@ -926,12 +925,12 @@ int foldMoveTo(const bool updown, const int dir, const int count)
// Open fold found, set cursor to its start/end and then check
// nested folds.
if (dir == FORWARD) {
- lnum = fp->fd_top + lnum_off + fp->fd_len - 1;
+ linenr_T lnum = fp->fd_top + lnum_off + fp->fd_len - 1;
if (lnum > curwin->w_cursor.lnum) {
lnum_found = lnum;
}
} else {
- lnum = fp->fd_top + lnum_off;
+ linenr_T lnum = fp->fd_top + lnum_off;
if (lnum < curwin->w_cursor.lnum) {
lnum_found = lnum;
}
@@ -999,7 +998,6 @@ void foldAdjustVisual(void)
}
pos_T *start, *end;
- char *ptr;
if (ltoreq(VIsual, curwin->w_cursor)) {
start = &VIsual;
@@ -1016,7 +1014,7 @@ void foldAdjustVisual(void)
return;
}
- ptr = ml_get(end->lnum);
+ char *ptr = ml_get(end->lnum);
end->col = (colnr_T)strlen(ptr);
if (end->col > 0 && *p_sel == 'o') {
end->col--;
@@ -2802,7 +2800,8 @@ void foldMoveRange(win_T *const wp, garray_T *gap, const linenr_T line1, const l
// Case 5 or 6: changes rely on whether there are folds between the end of
// this fold and "dest".
size_t move_start = FOLD_INDEX(fp, gap);
- size_t move_end = 0, dest_index = 0;
+ size_t move_end = 0;
+ size_t dest_index = 0;
for (; VALID_FOLD(fp, gap) && fp->fd_top <= dest; fp++) {
if (fp->fd_top <= line2) {
// 5, or 6