mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 22:48:34 +00:00
lint
This commit is contained in:
@@ -577,10 +577,11 @@ void foldCreate(win_T *wp, linenr_T start, linenr_T end)
|
|||||||
i = 0;
|
i = 0;
|
||||||
} else {
|
} else {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (!foldFind(gap, start_rel, &fp))
|
if (!foldFind(gap, start_rel, &fp)) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
if (fp->fd_top + fp->fd_len > end_rel) {
|
if (fp->fd_top + fp->fd_len > end_rel) {
|
||||||
/* New fold is completely inside this fold: Go one level deeper. */
|
// New fold is completely inside this fold: Go one level deeper.
|
||||||
gap = &fp->fd_nested;
|
gap = &fp->fd_nested;
|
||||||
start_rel -= fp->fd_top;
|
start_rel -= fp->fd_top;
|
||||||
end_rel -= fp->fd_top;
|
end_rel -= fp->fd_top;
|
||||||
@@ -594,8 +595,8 @@ void foldCreate(win_T *wp, linenr_T start, linenr_T end)
|
|||||||
}
|
}
|
||||||
level++;
|
level++;
|
||||||
} else {
|
} else {
|
||||||
/* This fold and new fold overlap: Insert here and move some folds
|
// This fold and new fold overlap: Insert here and move some folds
|
||||||
* inside the new fold. */
|
// inside the new fold.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1064,14 +1065,14 @@ void cloneFoldGrowArray(garray_T *from, garray_T *to)
|
|||||||
* the first fold below it (careful: it can be beyond the end of the array!).
|
* the first fold below it (careful: it can be beyond the end of the array!).
|
||||||
* Returns FALSE when there is no fold that contains "lnum".
|
* Returns FALSE when there is no fold that contains "lnum".
|
||||||
*/
|
*/
|
||||||
static int foldFind(const garray_T *gap, linenr_T lnum, fold_T **fpp)
|
static bool foldFind(const garray_T *gap, linenr_T lnum, fold_T **fpp)
|
||||||
{
|
{
|
||||||
linenr_T low, high;
|
linenr_T low, high;
|
||||||
fold_T *fp;
|
fold_T *fp;
|
||||||
|
|
||||||
if (gap->ga_len == 0) {
|
if (gap->ga_len == 0) {
|
||||||
*fpp = NULL;
|
*fpp = NULL;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1097,7 +1098,7 @@ static int foldFind(const garray_T *gap, linenr_T lnum, fold_T **fpp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*fpp = fp + low;
|
*fpp = fp + low;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* foldLevelWin() {{{2 */
|
/* foldLevelWin() {{{2 */
|
||||||
@@ -1231,9 +1232,10 @@ setManualFoldWin(
|
|||||||
gap = &wp->w_folds;
|
gap = &wp->w_folds;
|
||||||
for (;; ) {
|
for (;; ) {
|
||||||
if (!foldFind(gap, lnum, &fp)) {
|
if (!foldFind(gap, lnum, &fp)) {
|
||||||
/* If there is a following fold, continue there next time. */
|
// If there is a following fold, continue there next time.
|
||||||
if (fp != NULL && fp < (fold_T *)gap->ga_data + gap->ga_len)
|
if (fp != NULL && fp < (fold_T *)gap->ga_data + gap->ga_len) {
|
||||||
next = fp->fd_top + off;
|
next = fp->fd_top + off;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2280,14 +2282,15 @@ static linenr_T foldUpdateIEMSRecurse(
|
|||||||
/* Find an existing fold to re-use. Preferably one that
|
/* Find an existing fold to re-use. Preferably one that
|
||||||
* includes startlnum, otherwise one that ends just before
|
* includes startlnum, otherwise one that ends just before
|
||||||
* startlnum or starts after it. */
|
* startlnum or starts after it. */
|
||||||
if (gap->ga_len > 0 && (foldFind(gap, startlnum, &fp)
|
if (gap->ga_len > 0
|
||||||
|| (fp < ((fold_T *)gap->ga_data) + gap->ga_len
|
&& (foldFind(gap, startlnum, &fp)
|
||||||
&& fp->fd_top <= firstlnum)
|
|| (fp < ((fold_T *)gap->ga_data) + gap->ga_len
|
||||||
|| foldFind(gap, firstlnum - concat, &fp)
|
&& fp->fd_top <= firstlnum)
|
||||||
|| (fp < ((fold_T *)gap->ga_data) + gap->ga_len
|
|| foldFind(gap, firstlnum - concat, &fp)
|
||||||
&& ((lvl < level && fp->fd_top < flp->lnum)
|
|| (fp < ((fold_T *)gap->ga_data) + gap->ga_len
|
||||||
|| (lvl >= level
|
&& ((lvl < level && fp->fd_top < flp->lnum)
|
||||||
&& fp->fd_top <= flp->lnum_save))))) {
|
|| (lvl >= level
|
||||||
|
&& fp->fd_top <= flp->lnum_save))))) {
|
||||||
if (fp->fd_top + fp->fd_len + concat > firstlnum) {
|
if (fp->fd_top + fp->fd_len + concat > firstlnum) {
|
||||||
/* Use existing fold for the new fold. If it starts
|
/* Use existing fold for the new fold. If it starts
|
||||||
* before where we started looking, extend it. If it
|
* before where we started looking, extend it. If it
|
||||||
@@ -2578,9 +2581,10 @@ static void foldInsert(garray_T *gap, int i)
|
|||||||
ga_grow(gap, 1);
|
ga_grow(gap, 1);
|
||||||
|
|
||||||
fp = (fold_T *)gap->ga_data + i;
|
fp = (fold_T *)gap->ga_data + i;
|
||||||
if (gap->ga_len > 0 && i < gap->ga_len)
|
if (gap->ga_len > 0 && i < gap->ga_len) {
|
||||||
memmove(fp + 1, fp, sizeof(fold_T) * (size_t)(gap->ga_len - i));
|
memmove(fp + 1, fp, sizeof(fold_T) * (size_t)(gap->ga_len - i));
|
||||||
++gap->ga_len;
|
}
|
||||||
|
gap->ga_len++;
|
||||||
ga_init(&fp->fd_nested, (int)sizeof(fold_T), 10);
|
ga_init(&fp->fd_nested, (int)sizeof(fold_T), 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user