feat(tui): support undercurl in WezTerm (#28037)

Also fix some typos in windows.ti while at it.

Close #21699
This commit is contained in:
zeertzjq 2024-03-26 14:25:01 +08:00 committed by GitHub
parent d6f406db45
commit a142670360
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 10 deletions

View File

@ -25,7 +25,7 @@ win32con|ANSI emulation for libuv on legacy console,
Se=\E[0 q, Ss=\E[%p1%d q,
use=cygwin, use=libuv+exkey,
conemu|ANIS X3.64 and Xterm 256 colors for ConEmu with libuv,
conemu|ANSI X3.64 and Xterm 256 colors for ConEmu with libuv,
ccc@, mc5i@, xenl@, acsc@, rmacs@, smacs@, blink@, cbt@,
cvvis@, cnorm=\E[?25h, cud1=\E[B, dim@, flash@, hts@, initc@, invis@, is2@,
kf46@, kf47@, kf48@, kf49@, kf50@, kf51@, kf52@, kf53@, kf54@,
@ -47,7 +47,7 @@ conemu|ANIS X3.64 and Xterm 256 colors for ConEmu with libuv,
kUP3@, kUP4@, kUP5@, kUP6@, kUP7@, rmxx@, smxx@, xm@,
use=libuv+basekey, use=libuv+exkey, use=xterm+256color, use=xterm-new,
vtpcon|ANIS emulation for console virtual terminal sequence with libuv,
vtpcon|ANSI emulation for console virtual terminal sequence with libuv,
ccc@, mc5i@, xenl@, blink@, acsc=jjkkllmmnnqqttuuvvwwxx,
cvvis@, cud1=\E[B, dim@, flash@,
initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E,

File diff suppressed because one or more lines are too long

View File

@ -347,12 +347,14 @@ static void terminfo_start(TUIData *tui)
const char *konsolev_env = os_getenv("KONSOLE_VERSION");
int konsolev = konsolev_env ? (int)strtol(konsolev_env, NULL, 10)
: (konsole ? 1 : 0);
bool wezterm = strequal(termprg, "WezTerm");
const char *weztermv = wezterm ? os_getenv("TERM_PROGRAM_VERSION") : NULL;
// truecolor support must be checked before patching/augmenting terminfo
tui->rgb = term_has_truecolor(tui, colorterm);
patch_terminfo_bugs(tui, term, colorterm, vtev, konsolev, iterm_env, nsterm);
augment_terminfo(tui, term, vtev, konsolev, iterm_env, nsterm);
augment_terminfo(tui, term, vtev, konsolev, weztermv, iterm_env, nsterm);
tui->can_change_scroll_region =
!!unibi_get_str(tui->ut, unibi_change_scroll_region);
tui->can_set_lr_margin =
@ -2168,7 +2170,7 @@ static void patch_terminfo_bugs(TUIData *tui, const char *term, const char *colo
/// This adds stuff that is not in standard terminfo as extended unibilium
/// capabilities.
static void augment_terminfo(TUIData *tui, const char *term, int vte_version, int konsolev,
bool iterm_env, bool nsterm)
const char *weztermv, bool iterm_env, bool nsterm)
{
unibi_term *ut = tui->ut;
bool xterm = terminfo_is_term_family(term, "xterm")
@ -2327,8 +2329,8 @@ static void augment_terminfo(TUIData *tui, const char *term, int vte_version, in
if (tui->unibi_ext.set_underline_style == -1) {
int ext_bool_Su = unibi_find_ext_bool(ut, "Su"); // used by kitty
if (vte_version >= 5102 || konsolev >= 221170
|| (ext_bool_Su != -1
&& unibi_get_ext_bool(ut, (size_t)ext_bool_Su))) {
|| (ext_bool_Su != -1 && unibi_get_ext_bool(ut, (size_t)ext_bool_Su))
|| (weztermv != NULL && strcmp(weztermv, "20210203-095643") > 0)) {
tui->unibi_ext.set_underline_style = (int)unibi_add_ext_str(ut, "ext.set_underline_style",
"\x1b[4:%p1%dm");
}