mirror of
https://github.com/neovim/neovim.git
synced 2025-10-16 23:06:14 +00:00
signs: fix overflow during adjustment on Windows (#14472)
On Windows, `new_lnum + MAXLNUM` causes overflow and as a result the
line number of that sign becomes invalid negative number. This occurs
when the `set signcolumn=yes`, in other words `signcolumn` is not `auto`
and the sign column is less than 2 columns.
The related change was made in the commit
f2ed7605da
. Originally the above addition
is only executed if `amount != MAXLNUM`, so reintroducing this check
fixes the bug and will hardly produces a new bug.
Fixes https://github.com/neovim/neovim/issues/14460
This commit is contained in:
@@ -742,15 +742,15 @@ void sign_mark_adjust(
|
||||
next = sign->se_next;
|
||||
new_lnum = sign->se_lnum;
|
||||
if (sign->se_lnum >= line1 && sign->se_lnum <= line2) {
|
||||
if (amount == MAXLNUM && (!is_fixed || signcol >= 2)) {
|
||||
if (amount != MAXLNUM) {
|
||||
new_lnum += amount;
|
||||
} else if (!is_fixed || signcol >= 2) {
|
||||
*lastp = next;
|
||||
if (next) {
|
||||
next->se_prev = last;
|
||||
}
|
||||
xfree(sign);
|
||||
continue;
|
||||
} else {
|
||||
new_lnum += amount;
|
||||
}
|
||||
} else if (sign->se_lnum > line2) {
|
||||
new_lnum += amount_after;
|
||||
|
Reference in New Issue
Block a user