From e624826447d83f1b79e5442d3695a7528cf578cf Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 30 Jan 2026 14:22:59 +0100 Subject: fixup: high-color-pair support was still broken in Scinterm * Also updated A_XXX attributes to WA_XXX, where the "new" wattr_set() APIs are used. This doesn't make a difference on ncurses and PDCurses, but the X/Open standard demands it. * Allow color pairs up to 32767 instead of only up to 32766. * We now always require Curses wide-character APIs due to Scinterm, which has to use mvwin_wch(). We were practically depending on wide-character support anyway, so this shouldn't really restrict portability. * teco_curses_add_wc() has been simplified, now that we can rely on wide-char APIs. Perhaps it should be removed altogether? --- src/interface-curses/interface.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/interface-curses/interface.c') diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c index 4f00bcf..6863a3b 100644 --- a/src/interface-curses/interface.c +++ b/src/interface-curses/interface.c @@ -244,7 +244,7 @@ static struct { static gshort teco_color_pair(attr_t *attr, gshort fg, gshort bg) { - static gshort next_pair = 1; + static guint next_pair = 1; /* * Basic support for monochrome terminals: @@ -255,7 +255,7 @@ teco_color_pair(attr_t *attr, gshort fg, gshort bg) */ if (!has_colors()) { if (bg != COLOR_BLACK) - *attr |= A_REVERSE; + *attr |= WA_REVERSE; return 0; } @@ -264,7 +264,7 @@ teco_color_pair(attr_t *attr, gshort fg, gshort bg) gpointer value = g_hash_table_lookup(teco_interface.pair_table, key); if (G_LIKELY(value != NULL)) return GPOINTER_TO_UINT(value); - if (G_UNLIKELY(next_pair >= MIN(COLOR_PAIRS, G_MAXSHORT))) + if (G_UNLIKELY(next_pair >= MIN(COLOR_PAIRS, G_MAXSHORT+1))) return 0; init_pair(next_pair, fg, bg); g_hash_table_insert(teco_interface.pair_table, key, GUINT_TO_POINTER(next_pair)); @@ -443,7 +443,7 @@ teco_interface_init(gint argc, gchar **argv) teco_cmdline_init(); /* * The default INDIC_STRIKE wouldn't be visible. - * Instead we use INDIC_SQUIGGLE, which is rendered as A_UNDERLINE. + * Instead we use INDIC_SQUIGGLE, which is rendered as WA_UNDERLINE. */ teco_cmdline_ssm(SCI_INDICSETSTYLE, INDICATOR_RUBBEDOUT, INDIC_SQUIGGLE); /* -- cgit v1.2.3