mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 20:08:17 +00:00
Merge pull request #12848 from jamessan/vim-8.2.1552
This commit is contained in:
@@ -346,7 +346,8 @@ submit_pr() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local git_remote
|
local git_remote
|
||||||
git_remote="$(find_git_remote)"
|
git_remote="$(find_git_remote)"
|
||||||
|
local pr_body
|
||||||
pr_body="$(git log --grep=vim-patch --reverse --format='#### %s%n%n%b%n' "${git_remote}"/master..HEAD)"
|
pr_body="$(git log --grep=vim-patch --reverse --format='#### %s%n%n%b%n' "${git_remote}"/master..HEAD)"
|
||||||
local patches
|
local patches
|
||||||
# Extract just the "vim-patch:X.Y.ZZZZ" or "vim-patch:sha" portion of each log
|
# Extract just the "vim-patch:X.Y.ZZZZ" or "vim-patch:sha" portion of each log
|
||||||
|
@@ -573,11 +573,15 @@ void foldCreate(win_T *wp, linenr_T start, linenr_T end)
|
|||||||
|
|
||||||
// Find the place to insert the new fold
|
// Find the place to insert the new fold
|
||||||
gap = &wp->w_folds;
|
gap = &wp->w_folds;
|
||||||
for (;; ) {
|
if (gap->ga_len == 0) {
|
||||||
if (!foldFind(gap, start_rel, &fp))
|
i = 0;
|
||||||
|
} else {
|
||||||
|
for (;;) {
|
||||||
|
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;
|
||||||
@@ -591,13 +595,14 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i = (int)(fp - (fold_T *)gap->ga_data);
|
i = (int)(fp - (fold_T *)gap->ga_data);
|
||||||
|
}
|
||||||
|
|
||||||
ga_grow(gap, 1);
|
ga_grow(gap, 1);
|
||||||
{
|
{
|
||||||
fp = (fold_T *)gap->ga_data + i;
|
fp = (fold_T *)gap->ga_data + i;
|
||||||
@@ -788,6 +793,7 @@ void foldUpdate(win_T *wp, linenr_T top, linenr_T bot)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wp->w_folds.ga_len > 0) {
|
||||||
// Mark all folds from top to bot as maybe-small.
|
// Mark all folds from top to bot as maybe-small.
|
||||||
fold_T *fp;
|
fold_T *fp;
|
||||||
(void)foldFind(&wp->w_folds, top, &fp);
|
(void)foldFind(&wp->w_folds, top, &fp);
|
||||||
@@ -796,6 +802,7 @@ void foldUpdate(win_T *wp, linenr_T top, linenr_T bot)
|
|||||||
fp->fd_small = kNone;
|
fp->fd_small = kNone;
|
||||||
fp++;
|
fp++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (foldmethodIsIndent(wp)
|
if (foldmethodIsIndent(wp)
|
||||||
|| foldmethodIsExpr(wp)
|
|| foldmethodIsExpr(wp)
|
||||||
@@ -1058,11 +1065,16 @@ 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) {
|
||||||
|
*fpp = NULL;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform a binary search.
|
* Perform a binary search.
|
||||||
* "low" is lowest index of possible match.
|
* "low" is lowest index of possible match.
|
||||||
@@ -1086,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 */
|
||||||
@@ -1220,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 < (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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2269,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 (foldFind(gap, startlnum, &fp)
|
if (gap->ga_len > 0
|
||||||
|
&& (foldFind(gap, startlnum, &fp)
|
||||||
|| (fp < ((fold_T *)gap->ga_data) + gap->ga_len
|
|| (fp < ((fold_T *)gap->ga_data) + gap->ga_len
|
||||||
&& fp->fd_top <= firstlnum)
|
&& fp->fd_top <= firstlnum)
|
||||||
|| foldFind(gap, firstlnum - concat, &fp)
|
|| foldFind(gap, firstlnum - concat, &fp)
|
||||||
|| (fp < ((fold_T *)gap->ga_data) + gap->ga_len
|
|| (fp < ((fold_T *)gap->ga_data) + gap->ga_len
|
||||||
&& ((lvl < level && fp->fd_top < flp->lnum)
|
&& ((lvl < level && fp->fd_top < flp->lnum)
|
||||||
|| (lvl >= level
|
|| (lvl >= level
|
||||||
&& fp->fd_top <= flp->lnum_save)))) {
|
&& 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
|
||||||
@@ -2367,7 +2381,11 @@ static linenr_T foldUpdateIEMSRecurse(
|
|||||||
} else {
|
} else {
|
||||||
/* Insert new fold. Careful: ga_data may be NULL and it
|
/* Insert new fold. Careful: ga_data may be NULL and it
|
||||||
* may change! */
|
* may change! */
|
||||||
|
if (gap->ga_len == 0) {
|
||||||
|
i = 0;
|
||||||
|
} else {
|
||||||
i = (int)(fp - (fold_T *)gap->ga_data);
|
i = (int)(fp - (fold_T *)gap->ga_data);
|
||||||
|
}
|
||||||
foldInsert(gap, i);
|
foldInsert(gap, i);
|
||||||
fp = (fold_T *)gap->ga_data + i;
|
fp = (fold_T *)gap->ga_data + i;
|
||||||
/* The new fold continues until bot, unless we find the
|
/* The new fold continues until bot, unless we find the
|
||||||
@@ -2563,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 (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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2600,7 +2619,7 @@ static void foldSplit(buf_T *buf, garray_T *const gap,
|
|||||||
* any between top and bot, they have been removed by the caller. */
|
* any between top and bot, they have been removed by the caller. */
|
||||||
garray_T *const gap1 = &fp->fd_nested;
|
garray_T *const gap1 = &fp->fd_nested;
|
||||||
garray_T *const gap2 = &fp[1].fd_nested;
|
garray_T *const gap2 = &fp[1].fd_nested;
|
||||||
(void)(foldFind(gap1, bot + 1 - fp->fd_top, &fp2));
|
if (foldFind(gap1, bot + 1 - fp->fd_top, &fp2)) {
|
||||||
const int len = (int)((fold_T *)gap1->ga_data + gap1->ga_len - fp2);
|
const int len = (int)((fold_T *)gap1->ga_data + gap1->ga_len - fp2);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
ga_grow(gap2, len);
|
ga_grow(gap2, len);
|
||||||
@@ -2612,6 +2631,7 @@ static void foldSplit(buf_T *buf, garray_T *const gap,
|
|||||||
gap2->ga_len = len;
|
gap2->ga_len = len;
|
||||||
gap1->ga_len -= len;
|
gap1->ga_len -= len;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fp->fd_len = top - fp->fd_top;
|
fp->fd_len = top - fp->fd_top;
|
||||||
fold_changed = true;
|
fold_changed = true;
|
||||||
}
|
}
|
||||||
@@ -2645,7 +2665,7 @@ static void foldRemove(
|
|||||||
return; // nothing to do
|
return; // nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;; ) {
|
while (gap->ga_len > 0) {
|
||||||
// Find fold that includes top or a following one.
|
// Find fold that includes top or a following one.
|
||||||
if (foldFind(gap, top, &fp) && fp->fd_top < top) {
|
if (foldFind(gap, top, &fp) && fp->fd_top < top) {
|
||||||
// 2: or 3: need to delete nested folds
|
// 2: or 3: need to delete nested folds
|
||||||
|
@@ -5663,6 +5663,9 @@ check_suggestions (
|
|||||||
int len;
|
int len;
|
||||||
hlf_T attr;
|
hlf_T attr;
|
||||||
|
|
||||||
|
if (gap->ga_len == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
stp = &SUG(*gap, 0);
|
stp = &SUG(*gap, 0);
|
||||||
for (int i = gap->ga_len - 1; i >= 0; --i) {
|
for (int i = gap->ga_len - 1; i >= 0; --i) {
|
||||||
// Need to append what follows to check for "the the".
|
// Need to append what follows to check for "the the".
|
||||||
|
Reference in New Issue
Block a user