Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2026-05-01 16:01:09 +01:00
2 changed files with 10 additions and 0 deletions

View File

@@ -207,10 +207,12 @@ control_free_sub(struct control_state *cs, struct control_sub *csub)
RB_FOREACH_SAFE(csp, control_sub_panes, &csub->panes, csp1) {
RB_REMOVE(control_sub_panes, &csub->panes, csp);
free(csp->last);
free(csp);
}
RB_FOREACH_SAFE(csw, control_sub_windows, &csub->windows, csw1) {
RB_REMOVE(control_sub_windows, &csub->windows, csw);
free(csw->last);
free(csw);
}
free(csub->last);

View File

@@ -301,6 +301,8 @@ mode_tree_clear_tagged(struct mode_tree_list *mtl)
void
mode_tree_up(struct mode_tree_data *mtd, int wrap)
{
if (mtd->line_size == 0)
return;
if (mtd->current == 0) {
if (wrap) {
mtd->current = mtd->line_size - 1;
@@ -317,6 +319,8 @@ mode_tree_up(struct mode_tree_data *mtd, int wrap)
int
mode_tree_down(struct mode_tree_data *mtd, int wrap)
{
if (mtd->line_size == 0)
return (0);
if (mtd->current == mtd->line_size - 1) {
if (wrap) {
mtd->current = 0;
@@ -363,6 +367,8 @@ mode_tree_swap(struct mode_tree_data *mtd, int direction)
void *
mode_tree_get_current(struct mode_tree_data *mtd)
{
if (mtd->line_size == 0)
return (NULL);
return (mtd->line_list[mtd->current].item->itemdata);
}
@@ -433,6 +439,8 @@ mode_tree_set_current(struct mode_tree_data *mtd, uint64_t tag)
return (1);
}
if (mtd->current >= mtd->line_size) {
if (mtd->line_size == 0)
return (0);
mtd->current = mtd->line_size - 1;
if (mtd->current > mtd->height - 1)
mtd->offset = mtd->current - mtd->height + 1;