mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
UTF-8: New struct screen_driver_opt engulfs most of struct screen_driver.
No behaviour changes yet, although padding may differ.
This commit is contained in:
parent
b6855c8616
commit
73b67d34dc
@ -110,6 +110,7 @@ struct screen_driver {
|
|||||||
* uniquely identify the screen_driver. */
|
* uniquely identify the screen_driver. */
|
||||||
enum term_mode_type type;
|
enum term_mode_type type;
|
||||||
|
|
||||||
|
struct screen_driver_opt {
|
||||||
#ifndef CONFIG_UTF8
|
#ifndef CONFIG_UTF8
|
||||||
/* Charsets when doing UTF8 I/O. */
|
/* Charsets when doing UTF8 I/O. */
|
||||||
/* [0] is the common charset and [1] is the frame charset.
|
/* [0] is the common charset and [1] is the frame charset.
|
||||||
@ -136,6 +137,7 @@ struct screen_driver {
|
|||||||
/* UTF-8 I/O. Forced on if the UTF-8 charset is selected. (bug 827) */
|
/* UTF-8 I/O. Forced on if the UTF-8 charset is selected. (bug 827) */
|
||||||
unsigned int utf8:1;
|
unsigned int utf8:1;
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
|
} opt;
|
||||||
|
|
||||||
/* The terminal._template_ name. */
|
/* The terminal._template_ name. */
|
||||||
unsigned char name[1]; /* XXX: Keep last! */
|
unsigned char name[1]; /* XXX: Keep last! */
|
||||||
@ -144,6 +146,7 @@ struct screen_driver {
|
|||||||
static const struct screen_driver dumb_screen_driver = {
|
static const struct screen_driver dumb_screen_driver = {
|
||||||
NULL_LIST_HEAD,
|
NULL_LIST_HEAD,
|
||||||
/* type: */ TERM_DUMB,
|
/* type: */ TERM_DUMB,
|
||||||
|
{
|
||||||
#ifndef CONFIG_UTF8
|
#ifndef CONFIG_UTF8
|
||||||
/* charsets: */ { -1, -1 }, /* No UTF8 I/O */
|
/* charsets: */ { -1, -1 }, /* No UTF8 I/O */
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
@ -155,11 +158,13 @@ static const struct screen_driver dumb_screen_driver = {
|
|||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
/* utf-8: */ 0,
|
/* utf-8: */ 0,
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct screen_driver vt100_screen_driver = {
|
static const struct screen_driver vt100_screen_driver = {
|
||||||
NULL_LIST_HEAD,
|
NULL_LIST_HEAD,
|
||||||
/* type: */ TERM_VT100,
|
/* type: */ TERM_VT100,
|
||||||
|
{
|
||||||
#ifndef CONFIG_UTF8
|
#ifndef CONFIG_UTF8
|
||||||
/* charsets: */ { -1, -1 }, /* No UTF8 I/O */
|
/* charsets: */ { -1, -1 }, /* No UTF8 I/O */
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
@ -171,11 +176,13 @@ static const struct screen_driver vt100_screen_driver = {
|
|||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
/* utf-8: */ 0,
|
/* utf-8: */ 0,
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct screen_driver linux_screen_driver = {
|
static const struct screen_driver linux_screen_driver = {
|
||||||
NULL_LIST_HEAD,
|
NULL_LIST_HEAD,
|
||||||
/* type: */ TERM_LINUX,
|
/* type: */ TERM_LINUX,
|
||||||
|
{
|
||||||
#ifndef CONFIG_UTF8
|
#ifndef CONFIG_UTF8
|
||||||
/* charsets: */ { -1, -1 }, /* No UTF8 I/O */
|
/* charsets: */ { -1, -1 }, /* No UTF8 I/O */
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
@ -187,11 +194,13 @@ static const struct screen_driver linux_screen_driver = {
|
|||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
/* utf-8: */ 0,
|
/* utf-8: */ 0,
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct screen_driver koi8_screen_driver = {
|
static const struct screen_driver koi8_screen_driver = {
|
||||||
NULL_LIST_HEAD,
|
NULL_LIST_HEAD,
|
||||||
/* type: */ TERM_KOI8,
|
/* type: */ TERM_KOI8,
|
||||||
|
{
|
||||||
#ifndef CONFIG_UTF8
|
#ifndef CONFIG_UTF8
|
||||||
/* charsets: */ { -1, -1 }, /* No UTF8 I/O */
|
/* charsets: */ { -1, -1 }, /* No UTF8 I/O */
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
@ -203,11 +212,13 @@ static const struct screen_driver koi8_screen_driver = {
|
|||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
/* utf-8: */ 0,
|
/* utf-8: */ 0,
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct screen_driver freebsd_screen_driver = {
|
static const struct screen_driver freebsd_screen_driver = {
|
||||||
NULL_LIST_HEAD,
|
NULL_LIST_HEAD,
|
||||||
/* type: */ TERM_FREEBSD,
|
/* type: */ TERM_FREEBSD,
|
||||||
|
{
|
||||||
#ifndef CONFIG_UTF8
|
#ifndef CONFIG_UTF8
|
||||||
/* charsets: */ { -1, -1 }, /* No UTF8 I/O */
|
/* charsets: */ { -1, -1 }, /* No UTF8 I/O */
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
@ -219,6 +230,7 @@ static const struct screen_driver freebsd_screen_driver = {
|
|||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
/* utf-8: */ 0,
|
/* utf-8: */ 0,
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* XXX: Keep in sync with enum term_mode_type. */
|
/* XXX: Keep in sync with enum term_mode_type. */
|
||||||
@ -231,9 +243,9 @@ static const struct screen_driver *const screen_drivers[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
#define use_utf8_io(driver) ((driver)->utf8)
|
#define use_utf8_io(driver) ((driver)->opt.utf8)
|
||||||
#else
|
#else
|
||||||
#define use_utf8_io(driver) ((driver)->charsets[0] != -1)
|
#define use_utf8_io(driver) ((driver)->opt.charsets[0] != -1)
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
|
|
||||||
static INIT_LIST_HEAD(active_screen_drivers);
|
static INIT_LIST_HEAD(active_screen_drivers);
|
||||||
@ -250,73 +262,73 @@ update_screen_driver(struct screen_driver *driver, struct option *term_spec)
|
|||||||
* UTF-8 I/O is disabled. (bug 827) */
|
* UTF-8 I/O is disabled. (bug 827) */
|
||||||
if (is_cp_utf8(cp))
|
if (is_cp_utf8(cp))
|
||||||
utf8_io = 1;
|
utf8_io = 1;
|
||||||
driver->utf8 = utf8_io;
|
driver->opt.utf8 = utf8_io;
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
|
|
||||||
driver->color_mode = get_opt_int_tree(term_spec, "colors");
|
driver->opt.color_mode = get_opt_int_tree(term_spec, "colors");
|
||||||
driver->transparent = get_opt_bool_tree(term_spec, "transparency");
|
driver->opt.transparent = get_opt_bool_tree(term_spec, "transparency");
|
||||||
|
|
||||||
if (get_opt_bool_tree(term_spec, "underline")) {
|
if (get_opt_bool_tree(term_spec, "underline")) {
|
||||||
driver->underline = underline_seqs;
|
driver->opt.underline = underline_seqs;
|
||||||
} else {
|
} else {
|
||||||
driver->underline = NULL;
|
driver->opt.underline = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
if (driver->type == TERM_LINUX) {
|
if (driver->type == TERM_LINUX) {
|
||||||
if (get_opt_bool_tree(term_spec, "restrict_852"))
|
if (get_opt_bool_tree(term_spec, "restrict_852"))
|
||||||
driver->frame = frame_restrict;
|
driver->opt.frame = frame_restrict;
|
||||||
|
|
||||||
if (get_opt_bool_tree(term_spec, "m11_hack"))
|
if (get_opt_bool_tree(term_spec, "m11_hack"))
|
||||||
driver->frame_seqs = m11_hack_frame_seqs;
|
driver->opt.frame_seqs = m11_hack_frame_seqs;
|
||||||
|
|
||||||
if (driver->utf8)
|
if (driver->opt.utf8)
|
||||||
driver->frame_seqs = utf8_linux_frame_seqs;
|
driver->opt.frame_seqs = utf8_linux_frame_seqs;
|
||||||
|
|
||||||
} else if (driver->type == TERM_FREEBSD) {
|
} else if (driver->type == TERM_FREEBSD) {
|
||||||
if (get_opt_bool_tree(term_spec, "m11_hack"))
|
if (get_opt_bool_tree(term_spec, "m11_hack"))
|
||||||
driver->frame_seqs = m11_hack_frame_seqs;
|
driver->opt.frame_seqs = m11_hack_frame_seqs;
|
||||||
|
|
||||||
} else if (driver->type == TERM_VT100) {
|
} else if (driver->type == TERM_VT100) {
|
||||||
driver->frame = frame_vt100;
|
driver->opt.frame = frame_vt100;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (utf8_io) {
|
if (utf8_io) {
|
||||||
driver->charsets[0] = cp;
|
driver->opt.charsets[0] = cp;
|
||||||
if (driver->type == TERM_LINUX) {
|
if (driver->type == TERM_LINUX) {
|
||||||
if (get_opt_bool_tree(term_spec, "restrict_852"))
|
if (get_opt_bool_tree(term_spec, "restrict_852"))
|
||||||
driver->frame = frame_restrict;
|
driver->opt.frame = frame_restrict;
|
||||||
|
|
||||||
driver->charsets[1] = get_cp_index("cp437");
|
driver->opt.charsets[1] = get_cp_index("cp437");
|
||||||
|
|
||||||
} else if (driver->type == TERM_FREEBSD) {
|
} else if (driver->type == TERM_FREEBSD) {
|
||||||
driver->charsets[1] = get_cp_index("cp437");
|
driver->opt.charsets[1] = get_cp_index("cp437");
|
||||||
|
|
||||||
} else if (driver->type == TERM_VT100) {
|
} else if (driver->type == TERM_VT100) {
|
||||||
driver->frame = frame_vt100_u;
|
driver->opt.frame = frame_vt100_u;
|
||||||
driver->charsets[1] = get_cp_index("cp437");
|
driver->opt.charsets[1] = get_cp_index("cp437");
|
||||||
|
|
||||||
} else if (driver->type == TERM_KOI8) {
|
} else if (driver->type == TERM_KOI8) {
|
||||||
driver->charsets[1] = get_cp_index("koi8-r");
|
driver->opt.charsets[1] = get_cp_index("koi8-r");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
driver->charsets[1] = driver->charsets[0];
|
driver->opt.charsets[1] = driver->opt.charsets[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
driver->charsets[0] = -1;
|
driver->opt.charsets[0] = -1;
|
||||||
if (driver->type == TERM_LINUX) {
|
if (driver->type == TERM_LINUX) {
|
||||||
if (get_opt_bool_tree(term_spec, "restrict_852"))
|
if (get_opt_bool_tree(term_spec, "restrict_852"))
|
||||||
driver->frame = frame_restrict;
|
driver->opt.frame = frame_restrict;
|
||||||
|
|
||||||
if (get_opt_bool_tree(term_spec, "m11_hack"))
|
if (get_opt_bool_tree(term_spec, "m11_hack"))
|
||||||
driver->frame_seqs = m11_hack_frame_seqs;
|
driver->opt.frame_seqs = m11_hack_frame_seqs;
|
||||||
|
|
||||||
} else if (driver->type == TERM_FREEBSD) {
|
} else if (driver->type == TERM_FREEBSD) {
|
||||||
if (get_opt_bool_tree(term_spec, "m11_hack"))
|
if (get_opt_bool_tree(term_spec, "m11_hack"))
|
||||||
driver->frame_seqs = m11_hack_frame_seqs;
|
driver->opt.frame_seqs = m11_hack_frame_seqs;
|
||||||
} else if (driver->type == TERM_VT100) {
|
} else if (driver->type == TERM_VT100) {
|
||||||
driver->frame = frame_vt100;
|
driver->opt.frame = frame_vt100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
@ -549,8 +561,8 @@ add_char_data(struct string *screen, struct screen_driver *driver,
|
|||||||
* For "UTF-32" above, the data can also be UCS_NO_CHAR.
|
* For "UTF-32" above, the data can also be UCS_NO_CHAR.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (border && driver->frame && data >= 176 && data < 224)
|
if (border && driver->opt.frame && data >= 176 && data < 224)
|
||||||
data = driver->frame[data - 176];
|
data = driver->opt.frame[data - 176];
|
||||||
|
|
||||||
if (use_utf8_io(driver)) {
|
if (use_utf8_io(driver)) {
|
||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
@ -562,7 +574,7 @@ add_char_data(struct string *screen, struct screen_driver *driver,
|
|||||||
add_to_string(screen, encode_utf8(data));
|
add_to_string(screen, encode_utf8(data));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
int charset = driver->charsets[!!border];
|
int charset = driver->opt.charsets[!!border];
|
||||||
|
|
||||||
if (border || isscreensafe(data))
|
if (border || isscreensafe(data))
|
||||||
add_to_string(screen, cp2utf8(charset, data));
|
add_to_string(screen, cp2utf8(charset, data));
|
||||||
@ -590,20 +602,20 @@ add_char16(struct string *screen, struct screen_driver *driver,
|
|||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
(!use_utf8_io(driver) || ch->data != UCS_NO_CHAR) &&
|
(!use_utf8_io(driver) || ch->data != UCS_NO_CHAR) &&
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
border != state->border && driver->frame_seqs
|
border != state->border && driver->opt.frame_seqs
|
||||||
) {
|
) {
|
||||||
state->border = border;
|
state->border = border;
|
||||||
add_term_string(screen, driver->frame_seqs[!!border]);
|
add_term_string(screen, driver->opt.frame_seqs[!!border]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
(!use_utf8_io(driver) || ch->data != UCS_NO_CHAR) &&
|
(!use_utf8_io(driver) || ch->data != UCS_NO_CHAR) &&
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
underline != state->underline && driver->underline
|
underline != state->underline && driver->opt.underline
|
||||||
) {
|
) {
|
||||||
state->underline = underline;
|
state->underline = underline;
|
||||||
add_term_string(screen, driver->underline[!!underline]);
|
add_term_string(screen, driver->opt.underline[!!underline]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -631,7 +643,7 @@ add_char16(struct string *screen, struct screen_driver *driver,
|
|||||||
|
|
||||||
add_bytes_to_string(screen, "\033[0", 3);
|
add_bytes_to_string(screen, "\033[0", 3);
|
||||||
|
|
||||||
/* @update_screen_driver has set @driver->color_mode
|
/* @update_screen_driver has set @driver->opt.color_mode
|
||||||
* according to terminal-type-specific options.
|
* according to terminal-type-specific options.
|
||||||
* The caller of @add_char16 has already partially
|
* The caller of @add_char16 has already partially
|
||||||
* checked it, but there are still these possibilities:
|
* checked it, but there are still these possibilities:
|
||||||
@ -639,13 +651,13 @@ add_char16(struct string *screen, struct screen_driver *driver,
|
|||||||
* perhaps use the standout attribute.
|
* perhaps use the standout attribute.
|
||||||
* - COLOR_MODE_16. Use 16 colors.
|
* - COLOR_MODE_16. Use 16 colors.
|
||||||
* - An unsupported color mode. Use 16 colors. */
|
* - An unsupported color mode. Use 16 colors. */
|
||||||
if (driver->color_mode != COLOR_MODE_MONO) {
|
if (driver->opt.color_mode != COLOR_MODE_MONO) {
|
||||||
unsigned char code[6] = ";30;40";
|
unsigned char code[6] = ";30;40";
|
||||||
unsigned char bgcolor = TERM_COLOR_BACKGROUND_16(ch->color);
|
unsigned char bgcolor = TERM_COLOR_BACKGROUND_16(ch->color);
|
||||||
|
|
||||||
code[2] += TERM_COLOR_FOREGROUND_16(ch->color);
|
code[2] += TERM_COLOR_FOREGROUND_16(ch->color);
|
||||||
|
|
||||||
if (!driver->transparent || bgcolor != 0) {
|
if (!driver->opt.transparent || bgcolor != 0) {
|
||||||
code[5] += bgcolor;
|
code[5] += bgcolor;
|
||||||
add_bytes_to_string(screen, code, 6);
|
add_bytes_to_string(screen, code, 6);
|
||||||
} else {
|
} else {
|
||||||
@ -658,7 +670,7 @@ add_char16(struct string *screen, struct screen_driver *driver,
|
|||||||
add_bytes_to_string(screen, ";7", 2);
|
add_bytes_to_string(screen, ";7", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (underline && driver->underline) {
|
if (underline && driver->opt.underline) {
|
||||||
add_bytes_to_string(screen, ";4", 2);
|
add_bytes_to_string(screen, ";4", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -742,14 +754,14 @@ add_char256(struct string *screen, struct screen_driver *driver,
|
|||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
attr_delta
|
attr_delta
|
||||||
) {
|
) {
|
||||||
if ((attr_delta & SCREEN_ATTR_FRAME) && driver->frame_seqs) {
|
if ((attr_delta & SCREEN_ATTR_FRAME) && driver->opt.frame_seqs) {
|
||||||
state->border = !!(ch->attr & SCREEN_ATTR_FRAME);
|
state->border = !!(ch->attr & SCREEN_ATTR_FRAME);
|
||||||
add_term_string(screen, driver->frame_seqs[state->border]);
|
add_term_string(screen, driver->opt.frame_seqs[state->border]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((attr_delta & SCREEN_ATTR_UNDERLINE) && driver->underline) {
|
if ((attr_delta & SCREEN_ATTR_UNDERLINE) && driver->opt.underline) {
|
||||||
state->underline = !!(ch->attr & SCREEN_ATTR_UNDERLINE);
|
state->underline = !!(ch->attr & SCREEN_ATTR_UNDERLINE);
|
||||||
add_term_string(screen, driver->underline[state->underline]);
|
add_term_string(screen, driver->opt.underline[state->underline]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attr_delta & SCREEN_ATTR_BOLD) {
|
if (attr_delta & SCREEN_ATTR_BOLD) {
|
||||||
@ -773,16 +785,16 @@ add_char256(struct string *screen, struct screen_driver *driver,
|
|||||||
copy_color_256(state->color, ch->color);
|
copy_color_256(state->color, ch->color);
|
||||||
|
|
||||||
add_foreground_color(screen, color256_seqs, ch);
|
add_foreground_color(screen, color256_seqs, ch);
|
||||||
if (!driver->transparent || ch->color[1] != 0) {
|
if (!driver->opt.transparent || ch->color[1] != 0) {
|
||||||
add_background_color(screen, color256_seqs, ch);
|
add_background_color(screen, color256_seqs, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ch->attr & SCREEN_ATTR_BOLD)
|
if (ch->attr & SCREEN_ATTR_BOLD)
|
||||||
add_bytes_to_string(screen, "\033[1m", 4);
|
add_bytes_to_string(screen, "\033[1m", 4);
|
||||||
|
|
||||||
if (ch->attr & SCREEN_ATTR_UNDERLINE && driver->underline) {
|
if (ch->attr & SCREEN_ATTR_UNDERLINE && driver->opt.underline) {
|
||||||
state->underline = !!(ch->attr & SCREEN_ATTR_UNDERLINE);
|
state->underline = !!(ch->attr & SCREEN_ATTR_UNDERLINE);
|
||||||
add_term_string(screen, driver->underline[state->underline]);
|
add_term_string(screen, driver->opt.underline[state->underline]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -857,14 +869,14 @@ add_char_true(struct string *screen, struct screen_driver *driver,
|
|||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
attr_delta
|
attr_delta
|
||||||
) {
|
) {
|
||||||
if ((attr_delta & SCREEN_ATTR_FRAME) && driver->frame_seqs) {
|
if ((attr_delta & SCREEN_ATTR_FRAME) && driver->opt.frame_seqs) {
|
||||||
state->border = !!(ch->attr & SCREEN_ATTR_FRAME);
|
state->border = !!(ch->attr & SCREEN_ATTR_FRAME);
|
||||||
add_term_string(screen, driver->frame_seqs[state->border]);
|
add_term_string(screen, driver->opt.frame_seqs[state->border]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((attr_delta & SCREEN_ATTR_UNDERLINE) && driver->underline) {
|
if ((attr_delta & SCREEN_ATTR_UNDERLINE) && driver->opt.underline) {
|
||||||
state->underline = !!(ch->attr & SCREEN_ATTR_UNDERLINE);
|
state->underline = !!(ch->attr & SCREEN_ATTR_UNDERLINE);
|
||||||
add_term_string(screen, driver->underline[state->underline]);
|
add_term_string(screen, driver->opt.underline[state->underline]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attr_delta & SCREEN_ATTR_BOLD) {
|
if (attr_delta & SCREEN_ATTR_BOLD) {
|
||||||
@ -888,16 +900,16 @@ add_char_true(struct string *screen, struct screen_driver *driver,
|
|||||||
copy_color_true(state->color, ch->color);
|
copy_color_true(state->color, ch->color);
|
||||||
|
|
||||||
add_true_foreground_color(screen, color_true_seqs, ch);
|
add_true_foreground_color(screen, color_true_seqs, ch);
|
||||||
if (!driver->transparent || !background_is_black(ch->color)) {
|
if (!driver->opt.transparent || !background_is_black(ch->color)) {
|
||||||
add_true_background_color(screen, color_true_seqs, ch);
|
add_true_background_color(screen, color_true_seqs, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ch->attr & SCREEN_ATTR_BOLD)
|
if (ch->attr & SCREEN_ATTR_BOLD)
|
||||||
add_bytes_to_string(screen, "\033[1m", 4);
|
add_bytes_to_string(screen, "\033[1m", 4);
|
||||||
|
|
||||||
if (ch->attr & SCREEN_ATTR_UNDERLINE && driver->underline) {
|
if (ch->attr & SCREEN_ATTR_UNDERLINE && driver->opt.underline) {
|
||||||
state->underline = !!(ch->attr & SCREEN_ATTR_UNDERLINE);
|
state->underline = !!(ch->attr & SCREEN_ATTR_UNDERLINE);
|
||||||
add_term_string(screen, driver->underline[state->underline]);
|
add_term_string(screen, driver->opt.underline[state->underline]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -982,7 +994,7 @@ redraw_screen(struct terminal *term)
|
|||||||
|
|
||||||
if (!init_string(&image)) return;
|
if (!init_string(&image)) return;
|
||||||
|
|
||||||
switch (driver->color_mode) {
|
switch (driver->opt.color_mode) {
|
||||||
default:
|
default:
|
||||||
/* If the desired color mode was not compiled in,
|
/* If the desired color mode was not compiled in,
|
||||||
* use 16 colors. */
|
* use 16 colors. */
|
||||||
@ -1007,19 +1019,19 @@ redraw_screen(struct terminal *term)
|
|||||||
#endif
|
#endif
|
||||||
case COLOR_MODES:
|
case COLOR_MODES:
|
||||||
case COLOR_MODE_DUMP:
|
case COLOR_MODE_DUMP:
|
||||||
INTERNAL("Invalid color mode (%d).", driver->color_mode);
|
INTERNAL("Invalid color mode (%d).", driver->opt.color_mode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image.length) {
|
if (image.length) {
|
||||||
if (driver->color_mode != COLOR_MODE_MONO)
|
if (driver->opt.color_mode != COLOR_MODE_MONO)
|
||||||
add_bytes_to_string(&image, "\033[37;40m", 8);
|
add_bytes_to_string(&image, "\033[37;40m", 8);
|
||||||
|
|
||||||
add_bytes_to_string(&image, "\033[0m", 4);
|
add_bytes_to_string(&image, "\033[0m", 4);
|
||||||
|
|
||||||
/* If we ended in border state end the frame mode. */
|
/* If we ended in border state end the frame mode. */
|
||||||
if (state.border && driver->frame_seqs)
|
if (state.border && driver->opt.frame_seqs)
|
||||||
add_term_string(&image, driver->frame_seqs[0]);
|
add_term_string(&image, driver->opt.frame_seqs[0]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user