mirror of
https://github.com/neovim/neovim.git
synced 2026-07-14 05:10:36 +00:00
Merge pull request #25186 from llllvvuu/fix/preserve_marktree_orderinh
fix(marktree): preserve ordering in `marktree_move`
This commit is contained in:
@@ -1178,6 +1178,9 @@ void marktree_move(MarkTree *b, MarkTreeIter *itr, int row, int col)
|
||||
}
|
||||
|
||||
if (internal) {
|
||||
if (key.pos.row == newpos.row && key.pos.col == newpos.col) {
|
||||
return;
|
||||
}
|
||||
key.pos = newpos;
|
||||
bool match;
|
||||
// tricky: could minimize movement in either direction better
|
||||
@@ -1185,7 +1188,7 @@ void marktree_move(MarkTree *b, MarkTreeIter *itr, int row, int col)
|
||||
if (!match) {
|
||||
new_i++;
|
||||
}
|
||||
if (new_i == itr->i || key_cmp(key, x->key[new_i]) == 0) {
|
||||
if (new_i == itr->i) {
|
||||
x->key[itr->i].pos = newpos;
|
||||
} else if (new_i < itr->i) {
|
||||
memmove(&x->key[new_i + 1], &x->key[new_i], sizeof(MTKey) * (size_t)(itr->i - new_i));
|
||||
|
||||
Reference in New Issue
Block a user