diff options
| author | Gerd Moellmann | 2001-04-25 18:31:33 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-04-25 18:31:33 +0000 |
| commit | 86a7d192df32a6a1ce9bbcc883a65a8aad24fa90 (patch) | |
| tree | 1eb0a4cc1401a9d2ceafa5af7876b765ab9e76bc | |
| parent | 75fe153b0c1de6ce6a253743490aca49373aca45 (diff) | |
| download | emacs-86a7d192df32a6a1ce9bbcc883a65a8aad24fa90.tar.gz emacs-86a7d192df32a6a1ce9bbcc883a65a8aad24fa90.zip | |
(toggle_highlight): New function.
(turn_on_face): Change handling of reverse video.
| -rw-r--r-- | src/term.c | 67 |
1 files changed, 50 insertions, 17 deletions
diff --git a/src/term.c b/src/term.c index 185b706a17b..a3a3ce9f93a 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -621,6 +621,15 @@ turn_on_highlight () | |||
| 621 | } | 621 | } |
| 622 | } | 622 | } |
| 623 | 623 | ||
| 624 | static void | ||
| 625 | toggle_highlight () | ||
| 626 | { | ||
| 627 | if (standout_mode) | ||
| 628 | turn_off_highlight (); | ||
| 629 | else | ||
| 630 | turn_on_highlight (); | ||
| 631 | } | ||
| 632 | |||
| 624 | 633 | ||
| 625 | /* Make cursor invisible. */ | 634 | /* Make cursor invisible. */ |
| 626 | 635 | ||
| @@ -2009,8 +2018,44 @@ turn_on_face (f, face_id) | |||
| 2009 | int face_id; | 2018 | int face_id; |
| 2010 | { | 2019 | { |
| 2011 | struct face *face = FACE_FROM_ID (f, face_id); | 2020 | struct face *face = FACE_FROM_ID (f, face_id); |
| 2021 | long fg = face->foreground; | ||
| 2022 | long bg = face->background; | ||
| 2012 | 2023 | ||
| 2013 | xassert (face != NULL); | 2024 | /* Do this first because TS_end_standout_mode may be the same |
| 2025 | as TS_exit_attribute_mode, which turns all appearances off. */ | ||
| 2026 | if (MAY_USE_WITH_COLORS_P (NC_REVERSE)) | ||
| 2027 | { | ||
| 2028 | if (TN_max_colors > 0) | ||
| 2029 | { | ||
| 2030 | if (fg >= 0 && bg >= 0) | ||
| 2031 | { | ||
| 2032 | /* If the terminal supports colors, we can set them | ||
| 2033 | below without using reverse video. The face's fg | ||
| 2034 | and bg colors are set as they should appear on | ||
| 2035 | the screen, i.e. they take the inverse-video'ness | ||
| 2036 | of the face already into account. */ | ||
| 2037 | } | ||
| 2038 | else if (inverse_video) | ||
| 2039 | { | ||
| 2040 | if (fg == FACE_TTY_DEFAULT_FG_COLOR | ||
| 2041 | || bg == FACE_TTY_DEFAULT_BG_COLOR) | ||
| 2042 | toggle_highlight (); | ||
| 2043 | } | ||
| 2044 | else | ||
| 2045 | { | ||
| 2046 | if (fg == FACE_TTY_DEFAULT_BG_COLOR | ||
| 2047 | || bg == FACE_TTY_DEFAULT_FG_COLOR) | ||
| 2048 | toggle_highlight (); | ||
| 2049 | } | ||
| 2050 | } | ||
| 2051 | else | ||
| 2052 | { | ||
| 2053 | /* If we can't display colors, use reverse video | ||
| 2054 | if the face specifies that. */ | ||
| 2055 | if (face->tty_reverse_p) | ||
| 2056 | toggle_highlight (); | ||
| 2057 | } | ||
| 2058 | } | ||
| 2014 | 2059 | ||
| 2015 | if (face->tty_bold_p) | 2060 | if (face->tty_bold_p) |
| 2016 | { | 2061 | { |
| @@ -2036,32 +2081,20 @@ turn_on_face (f, face_id) | |||
| 2036 | && MAY_USE_WITH_COLORS_P (NC_UNDERLINE)) | 2081 | && MAY_USE_WITH_COLORS_P (NC_UNDERLINE)) |
| 2037 | OUTPUT1_IF (TS_enter_underline_mode); | 2082 | OUTPUT1_IF (TS_enter_underline_mode); |
| 2038 | 2083 | ||
| 2039 | if (MAY_USE_WITH_COLORS_P (NC_REVERSE)) | ||
| 2040 | if (face->tty_reverse_p | ||
| 2041 | || face->foreground == FACE_TTY_DEFAULT_BG_COLOR | ||
| 2042 | || face->background == FACE_TTY_DEFAULT_FG_COLOR) | ||
| 2043 | OUTPUT1_IF (TS_enter_reverse_mode); | ||
| 2044 | |||
| 2045 | if (TN_max_colors > 0) | 2084 | if (TN_max_colors > 0) |
| 2046 | { | 2085 | { |
| 2047 | char *p; | 2086 | char *p; |
| 2048 | 2087 | ||
| 2049 | if (face->foreground != FACE_TTY_DEFAULT_COLOR | 2088 | if (fg >= 0 && TS_set_foreground) |
| 2050 | && face->foreground != FACE_TTY_DEFAULT_FG_COLOR | ||
| 2051 | && face->foreground != FACE_TTY_DEFAULT_BG_COLOR | ||
| 2052 | && TS_set_foreground) | ||
| 2053 | { | 2089 | { |
| 2054 | p = tparam (TS_set_foreground, NULL, 0, (int) face->foreground); | 2090 | p = tparam (TS_set_foreground, NULL, 0, (int) fg); |
| 2055 | OUTPUT (p); | 2091 | OUTPUT (p); |
| 2056 | xfree (p); | 2092 | xfree (p); |
| 2057 | } | 2093 | } |
| 2058 | 2094 | ||
| 2059 | if (face->background != FACE_TTY_DEFAULT_COLOR | 2095 | if (bg >= 0 && TS_set_background) |
| 2060 | && face->background != FACE_TTY_DEFAULT_BG_COLOR | ||
| 2061 | && face->background != FACE_TTY_DEFAULT_FG_COLOR | ||
| 2062 | && TS_set_background) | ||
| 2063 | { | 2096 | { |
| 2064 | p = tparam (TS_set_background, NULL, 0, (int) face->background); | 2097 | p = tparam (TS_set_background, NULL, 0, (int) bg); |
| 2065 | OUTPUT (p); | 2098 | OUTPUT (p); |
| 2066 | xfree (p); | 2099 | xfree (p); |
| 2067 | } | 2100 | } |