diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-03-13 02:28:23 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-03-13 02:28:23 +0300 |
commit | 8d8d62a108d6329049dac63f25c6119db6c44d12 (patch) | |
tree | 683b9f7675f0a0b2891de1e4524e4eb85ac2db17 | |
parent | 541bee1c6d56ce81a0302263af006b53dc1aea64 (diff) | |
download | sciteco-8d8d62a108d6329049dac63f25c6119db6c44d12.tar.gz |
updated Scinterm: my monochrome patch was merged only with some modifications
* SCI_COLOR_PAIR() is now a function teco_color_pair() since it also became
an inline function in Scinterm.
-rw-r--r-- | .gitmodules | 2 | ||||
m--------- | contrib/scinterm | 0 | ||||
-rw-r--r-- | src/interface-curses/interface.c | 18 |
3 files changed, 12 insertions, 8 deletions
diff --git a/.gitmodules b/.gitmodules index db70f81..ed91108 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,7 +4,7 @@ ignore = untracked [submodule "scinterm"] path = contrib/scinterm - url = https://github.com/rhaberkorn/scinterm.git + url = https://github.com/orbitalquark/scinterm.git [submodule "lexilla"] path = contrib/lexilla url = https://github.com/ScintillaOrg/lexilla.git diff --git a/contrib/scinterm b/contrib/scinterm -Subproject 3a47c1b053c7316a4237d55fce125683a43eca2 +Subproject fcc2c2028f3c21410ba8e5eff95b2013acb798b diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c index 206ff30..2e87601 100644 --- a/src/interface-curses/interface.c +++ b/src/interface-curses/interface.c @@ -167,12 +167,16 @@ static gint teco_xterm_version(void) G_GNUC_UNUSED; * Returns the curses `COLOR_PAIR` for the given curses foreground and background `COLOR`s. * This is used simply to enumerate every possible color combination. * Note: only 256 combinations are possible due to curses portability. - * Note: This references the global curses variable `COLORS` and is not a constant expression. - * @param f The curses foreground `COLOR`. - * @param b The curses background `COLOR`. - * @return int number for defining a curses `COLOR_PAIR`. + * + * @param fg The curses foreground `COLOR`. + * @param bg The curses background `COLOR`. + * @return number for defining a curses `COLOR_PAIR`. */ -#define SCI_COLOR_PAIR(f, b) ((b) * ((COLORS < 16) ? 8 : 16) + (f) + 1) +static inline gshort +teco_color_pair(gshort fg, gshort bg) +{ + return bg * (COLORS < 16 ? 8 : 16) + fg + 1; +} /** * Curses attribute for the color combination @@ -188,7 +192,7 @@ static inline attr_t teco_color_attr(gshort fg, gshort bg) { if (has_colors()) - return COLOR_PAIR(SCI_COLOR_PAIR(fg, bg)); + return COLOR_PAIR(teco_color_pair(fg, bg)); /* * Basic support for monochrome terminals: @@ -1121,7 +1125,7 @@ teco_interface_cmdline_update(const teco_cmdline_t *cmdline) short fg = teco_rgb2curses(teco_interface_ssm(SCI_STYLEGETFORE, STYLE_DEFAULT, 0)); short bg = teco_rgb2curses(teco_interface_ssm(SCI_STYLEGETBACK, STYLE_DEFAULT, 0)); - wcolor_set(teco_interface.cmdline_pad, SCI_COLOR_PAIR(fg, bg), NULL); + wcolor_set(teco_interface.cmdline_pad, teco_color_pair(fg, bg), NULL); /* format effective command line */ teco_interface.cmdline_len = |