Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2025-12-03 10:01:09 +00:00
2 changed files with 14 additions and 15 deletions

View File

@@ -1082,22 +1082,22 @@ colour_palette_free(struct colour_palette *p)
/* Get a colour from a palette. */ /* Get a colour from a palette. */
int int
colour_palette_get(struct colour_palette *p, int c) colour_palette_get(struct colour_palette *p, int n)
{ {
if (p == NULL) if (p == NULL)
return (-1); return (-1);
if (c >= 90 && c <= 97) if (n >= 90 && n <= 97)
c = 8 + c - 90; n = 8 + n - 90;
else if (c & COLOUR_FLAG_256) else if (n & COLOUR_FLAG_256)
c &= ~COLOUR_FLAG_256; n &= ~COLOUR_FLAG_256;
else if (c >= 8) else if (n >= 8)
return (-1); return (-1);
if (p->palette != NULL && p->palette[c] != -1) if (p->palette != NULL && p->palette[n] != -1)
return (p->palette[c]); return (p->palette[n]);
if (p->default_palette != NULL && p->default_palette[c] != -1) if (p->default_palette != NULL && p->default_palette[n] != -1)
return (p->default_palette[c]); return (p->default_palette[n]);
return (-1); return (-1);
} }
@@ -1107,14 +1107,13 @@ colour_palette_set(struct colour_palette *p, int n, int c)
{ {
u_int i; u_int i;
if (p == NULL || n > 255) if (p == NULL || n < 0 || n > 255)
return (0); return (0);
if (c == -1 && p->palette == NULL) if (c == -1 && p->palette == NULL)
return (0); return (0);
if (c != -1 && p->palette == NULL) { if (p->palette == NULL) {
if (p->palette == NULL)
p->palette = xcalloc(256, sizeof *p->palette); p->palette = xcalloc(256, sizeof *p->palette);
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
p->palette[i] = -1; p->palette[i] = -1;

View File

@@ -1780,7 +1780,7 @@ window_pane_mode(struct window_pane *wp)
int int
window_pane_show_scrollbar(struct window_pane *wp, int sb_option) window_pane_show_scrollbar(struct window_pane *wp, int sb_option)
{ {
if (SCREEN_IS_ALTERNATE(wp->screen)) if (SCREEN_IS_ALTERNATE(&wp->base))
return (0); return (0);
if (sb_option == PANE_SCROLLBARS_ALWAYS || if (sb_option == PANE_SCROLLBARS_ALWAYS ||
(sb_option == PANE_SCROLLBARS_MODAL && (sb_option == PANE_SCROLLBARS_MODAL &&