Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2025-05-01 10:01:11 +01:00
4 changed files with 57 additions and 34 deletions

View File

@ -479,6 +479,14 @@ const struct options_table_entry options_table[] = {
"'User0', 'User1' and so on."
},
{ .name = "variation-selector-always-wide",
.type = OPTIONS_TABLE_FLAG,
.scope = OPTIONS_TABLE_SERVER,
.default_num = 1,
.text = "If the Unicode VS16 codepoint should always be treated as a "
"wide character."
},
/* Session options. */
{ .name = "activity-action",
.type = OPTIONS_TABLE_CHOICE,

View File

@ -2105,9 +2105,11 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
*/
if (utf8_is_zwj(ud))
zero_width = 1;
else if (utf8_is_vs(ud))
zero_width = force_wide = 1;
else if (ud->width == 0)
else if (utf8_is_vs(ud)) {
zero_width = 1;
if (options_get_number(global_options, "variation-selector-always-wide"))
force_wide = 1;
} else if (ud->width == 0)
zero_width = 1;
/* Cannot combine empty character or at left. */

5
tmux.1
View File

@ -4394,6 +4394,11 @@ For example:
set -s user-keys[0] "\ee[5;30012\[ti]"
bind User0 resize-pane -L 3
.Ed
.It Xo Ic variation-selector-always-wide
.Op Ic on | off
.Xc
Always treat Unicode variation selector 16 as marking a wide character.
This is a feature of some terminals as part of their Unicode 14 support.
.El
.Pp
Available session options are:

24
tty.c
View File

@ -2882,15 +2882,23 @@ tty_check_fg(struct tty *tty, struct colour_palette *palette,
/* Is this a 256-colour colour? */
if (gc->fg & COLOUR_FLAG_256) {
/* And not a 256 colour mode? */
if (colours < 256) {
if (colours >= 256)
return;
gc->fg = colour_256to16(gc->fg);
if (gc->fg & 8) {
if (~gc->fg & 8)
return;
gc->fg &= 7;
if (colours >= 16)
gc->fg += 90;
else if (gc->fg == 0 && gc->bg == 0)
else {
/*
* Mapping to black-on-black or white-on-white is not
* much use, so change the foreground.
*/
if (gc->fg == 0 && gc->bg == 0)
gc->fg = 7;
}
else if (gc->fg == 7 && gc->bg == 7)
gc->fg = 0;
}
return;
}
@ -2938,14 +2946,14 @@ tty_check_bg(struct tty *tty, struct colour_palette *palette,
* palette. Bold background doesn't exist portably, so just
* discard the bold bit if set.
*/
if (colours < 256) {
if (colours >= 256)
return;
gc->bg = colour_256to16(gc->bg);
if (gc->bg & 8) {
if (~gc->bg & 8)
return;
gc->bg &= 7;
if (colours >= 16)
gc->bg += 90;
}
}
return;
}