Adjust the logic when deleting last buffer to better preserve the

selection: if selecting the element below the deleted one fails (because
as the last one), select the one above it instead. From Daniel Mueller,
GitHub issue 4043.
This commit is contained in:
nicm
2024-08-04 08:53:43 +00:00
parent ddd4e57c65
commit 7b6fbe7262
3 changed files with 18 additions and 7 deletions

View File

@ -261,19 +261,21 @@ mode_tree_up(struct mode_tree_data *mtd, int wrap)
}
}
void
int
mode_tree_down(struct mode_tree_data *mtd, int wrap)
{
if (mtd->current == mtd->line_size - 1) {
if (wrap) {
mtd->current = 0;
mtd->offset = 0;
}
} else
return (0);
} else {
mtd->current++;
if (mtd->current > mtd->offset + mtd->height - 1)
mtd->offset++;
}
return (1);
}
void *