aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorChong Yidong2012-06-10 00:44:44 +0800
committerChong Yidong2012-06-10 00:44:44 +0800
commitcd4eb164a9cb5fd4df2290423830471d6086fd1e (patch)
tree2c0cd8990ab457f7818a8284e4567c6a3c51a6fd /src/term.c
parent4f5d2ba15c0dbe248fea1faea9a319435b5fe31a (diff)
downloademacs-cd4eb164a9cb5fd4df2290423830471d6086fd1e.tar.gz
emacs-cd4eb164a9cb5fd4df2290423830471d6086fd1e.zip
Add support for italic text on ttys.
* src/dispextern.h: Replace unused TTY_CAP_BLINK with TTY_CAP_ITALIC. (struct face): Remove unused fields tty_dim_p, tty_blinking_p, and tty_alt_charset_p. Add tty_italic_p. * src/term.c: Support italics in capable terminals. (no_color_bit): Replace unused NC_BLINK with NC_ITALIC. (turn_on_face): Output using TS_enter_italic_mode if available. Don't handle unused blinking and alt-charset cases. (turn_off_face): Handle italic case; discard unused tty_blinking_p and tty_alt_charset_p cases. (tty_capable_p, init_tty): Support italics. * src/termchar.h (struct tty_display_info): Add field for italics. Remove unused blink field. * src/xfaces.c (tty_supports_face_attributes_p, realize_tty_face): Handle slant. Fixes: debbugs:9652
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/src/term.c b/src/term.c
index 3d7a677374c..8ce2efc0929 100644
--- a/src/term.c
+++ b/src/term.c
@@ -122,12 +122,11 @@ enum no_color_bit
122 NC_STANDOUT = 1 << 0, 122 NC_STANDOUT = 1 << 0,
123 NC_UNDERLINE = 1 << 1, 123 NC_UNDERLINE = 1 << 1,
124 NC_REVERSE = 1 << 2, 124 NC_REVERSE = 1 << 2,
125 NC_BLINK = 1 << 3, 125 NC_ITALIC = 1 << 3,
126 NC_DIM = 1 << 4, 126 NC_DIM = 1 << 4,
127 NC_BOLD = 1 << 5, 127 NC_BOLD = 1 << 5,
128 NC_INVIS = 1 << 6, 128 NC_INVIS = 1 << 6,
129 NC_PROTECT = 1 << 7, 129 NC_PROTECT = 1 << 7
130 NC_ALT_CHARSET = 1 << 8
131}; 130};
132 131
133/* internal state */ 132/* internal state */
@@ -2022,17 +2021,16 @@ turn_on_face (struct frame *f, int face_id)
2022 if (face->tty_bold_p && MAY_USE_WITH_COLORS_P (tty, NC_BOLD)) 2021 if (face->tty_bold_p && MAY_USE_WITH_COLORS_P (tty, NC_BOLD))
2023 OUTPUT1_IF (tty, tty->TS_enter_bold_mode); 2022 OUTPUT1_IF (tty, tty->TS_enter_bold_mode);
2024 2023
2025 if (face->tty_dim_p && MAY_USE_WITH_COLORS_P (tty, NC_DIM)) 2024 if (face->tty_italic_p && MAY_USE_WITH_COLORS_P (tty, NC_ITALIC))
2026 OUTPUT1_IF (tty, tty->TS_enter_dim_mode); 2025 {
2027 2026 if (tty->TS_enter_italic_mode)
2028 /* Alternate charset and blinking not yet used. */ 2027 OUTPUT1 (tty, tty->TS_enter_italic_mode);
2029 if (face->tty_alt_charset_p 2028 else
2030 && MAY_USE_WITH_COLORS_P (tty, NC_ALT_CHARSET)) 2029 /* Italics mode is unavailable on many terminals. In that
2031 OUTPUT1_IF (tty, tty->TS_enter_alt_charset_mode); 2030 case, map slant to dimmed text; we want italic text to
2032 2031 appear different and dimming is not otherwise used. */
2033 if (face->tty_blinking_p 2032 OUTPUT1 (tty, tty->TS_enter_dim_mode);
2034 && MAY_USE_WITH_COLORS_P (tty, NC_BLINK)) 2033 }
2035 OUTPUT1_IF (tty, tty->TS_enter_blink_mode);
2036 2034
2037 if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE)) 2035 if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE))
2038 OUTPUT1_IF (tty, tty->TS_enter_underline_mode); 2036 OUTPUT1_IF (tty, tty->TS_enter_underline_mode);
@@ -2077,27 +2075,19 @@ turn_off_face (struct frame *f, int face_id)
2077 half-bright, reverse-video, standout, underline. It may or 2075 half-bright, reverse-video, standout, underline. It may or
2078 may not turn off alt-char-mode. */ 2076 may not turn off alt-char-mode. */
2079 if (face->tty_bold_p 2077 if (face->tty_bold_p
2080 || face->tty_dim_p 2078 || face->tty_italic_p
2081 || face->tty_reverse_p 2079 || face->tty_reverse_p
2082 || face->tty_alt_charset_p
2083 || face->tty_blinking_p
2084 || face->tty_underline_p) 2080 || face->tty_underline_p)
2085 { 2081 {
2086 OUTPUT1_IF (tty, tty->TS_exit_attribute_mode); 2082 OUTPUT1_IF (tty, tty->TS_exit_attribute_mode);
2087 if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0) 2083 if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0)
2088 tty->standout_mode = 0; 2084 tty->standout_mode = 0;
2089 } 2085 }
2090
2091 if (face->tty_alt_charset_p)
2092 OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
2093 } 2086 }
2094 else 2087 else
2095 { 2088 {
2096 /* If we don't have "me" we can only have those appearances 2089 /* If we don't have "me" we can only have those appearances
2097 that have exit sequences defined. */ 2090 that have exit sequences defined. */
2098 if (face->tty_alt_charset_p)
2099 OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
2100
2101 if (face->tty_underline_p) 2091 if (face->tty_underline_p)
2102 OUTPUT_IF (tty, tty->TS_exit_underline_mode); 2092 OUTPUT_IF (tty, tty->TS_exit_underline_mode);
2103 } 2093 }
@@ -2128,8 +2118,7 @@ tty_capable_p (struct tty_display_info *tty, unsigned int caps,
2128 TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, tty->TS_enter_underline_mode, NC_UNDERLINE); 2118 TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, tty->TS_enter_underline_mode, NC_UNDERLINE);
2129 TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, tty->TS_enter_bold_mode, NC_BOLD); 2119 TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, tty->TS_enter_bold_mode, NC_BOLD);
2130 TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, tty->TS_enter_dim_mode, NC_DIM); 2120 TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, tty->TS_enter_dim_mode, NC_DIM);
2131 TTY_CAPABLE_P_TRY (tty, TTY_CAP_BLINK, tty->TS_enter_blink_mode, NC_BLINK); 2121 TTY_CAPABLE_P_TRY (tty, TTY_CAP_ITALIC, tty->TS_enter_italic_mode, NC_ITALIC);
2132 TTY_CAPABLE_P_TRY (tty, TTY_CAP_ALT_CHARSET, tty->TS_enter_alt_charset_mode, NC_ALT_CHARSET);
2133 2122
2134 /* We can do it! */ 2123 /* We can do it! */
2135 return 1; 2124 return 1;
@@ -3222,8 +3211,8 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3222 tty->TS_enter_underline_mode = tgetstr ("us", address); 3211 tty->TS_enter_underline_mode = tgetstr ("us", address);
3223 tty->TS_exit_underline_mode = tgetstr ("ue", address); 3212 tty->TS_exit_underline_mode = tgetstr ("ue", address);
3224 tty->TS_enter_bold_mode = tgetstr ("md", address); 3213 tty->TS_enter_bold_mode = tgetstr ("md", address);
3214 tty->TS_enter_italic_mode = tgetstr ("ZH", address);
3225 tty->TS_enter_dim_mode = tgetstr ("mh", address); 3215 tty->TS_enter_dim_mode = tgetstr ("mh", address);
3226 tty->TS_enter_blink_mode = tgetstr ("mb", address);
3227 tty->TS_enter_reverse_mode = tgetstr ("mr", address); 3216 tty->TS_enter_reverse_mode = tgetstr ("mr", address);
3228 tty->TS_enter_alt_charset_mode = tgetstr ("as", address); 3217 tty->TS_enter_alt_charset_mode = tgetstr ("as", address);
3229 tty->TS_exit_alt_charset_mode = tgetstr ("ae", address); 3218 tty->TS_exit_alt_charset_mode = tgetstr ("ae", address);