Discussion:
[PATCH] hide OPT_MONO_* in 'M'enu when use_color=on
Dennis Preiser
2011-10-27 16:55:37 UTC
Permalink
The 'M'enu items for "Attr. of highlighting with *stars*, _dash_,
/slash/ and -stroke-" are displayed even if use_color=on.

This is misleading, because the attributes have no effect when
use_color=on. The patch below hides this items when use_color=on.

Dennis

diff -urp tin-2.1.0_r2/src/options_menu.c tin-2.1.0_r3/src/options_menu.c
--- tin-2.1.0_r2/src/options_menu.c 2011-10-09 16:20:23.000000000 +0200
+++ tin-2.1.0_r3/src/options_menu.c 2011-10-27 18:02:22.000000000 +0200
@@ -218,16 +218,18 @@ option_is_visible(
#endif /* HAVE_COLOR */

case OPT_WORD_H_DISPLAY_MARKS:
- case OPT_MONO_MARKSTAR:
- case OPT_MONO_MARKDASH:
- case OPT_MONO_MARKSLASH:
- case OPT_MONO_MARKSTROKE:
case OPT_SLASHES_REGEX:
case OPT_STARS_REGEX:
case OPT_STROKES_REGEX:
case OPT_UNDERSCORES_REGEX:
return curr_scope ? FALSE : tinrc.word_highlight;

+ case OPT_MONO_MARKSTAR:
+ case OPT_MONO_MARKDASH:
+ case OPT_MONO_MARKSLASH:
+ case OPT_MONO_MARKSTROKE:
+ return curr_scope ? FALSE : (tinrc.word_highlight && !tinrc.use_color);
+
#if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
case OPT_UTF8_GRAPHICS:
return curr_scope ? FALSE : IS_LOCAL_CHARSET("UTF-8");
Urs Janßen
2011-10-27 18:27:29 UTC
Permalink
Post by Dennis Preiser
return curr_scope ? FALSE : tinrc.word_highlight;
+ return curr_scope ? FALSE : (tinrc.word_highlight && !tinrc.use_color);
+
tinrc.use_color is only available if the system can do colors (HAVE_COLOR is
set) on other systems you end up with

./options_menu.c: In function 'option_is_visible':
./options_menu.c:231: error: 'struct t_config' has no member named
'use_color'
make: *** [options_menu.o] Error 1

urs
--
"Only whimps use tape backup: _real_ men just upload their important stuff
on ftp, and let the rest of the world mirror it ;)" - Linus
Dennis Preiser
2011-10-27 19:18:01 UTC
Permalink
Post by Urs Janßen
Post by Dennis Preiser
+ return curr_scope ? FALSE : (tinrc.word_highlight && !tinrc.use_color);
+
tinrc.use_color is only available if the system can do colors (HAVE_COLOR is
set) on other systems you end up with
./options_menu.c:231: error: 'struct t_config' has no member named
'use_color'
make: *** [options_menu.o] Error 1
Attached a revised patch which supersedes the previous one.

In addition, I've added a new section "Highlight Options". This section
will be displayed instead of "Color Options" in the !HAVE_COLOR case.
The items in question were arranged under "Filtering Options" before.

Dennis

Loading...