From d62bbe24cbe5311ce595d73a0c40dc87af989666 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 30 Nov 2025 11:22:12 -0500 Subject: [PATCH] fix(tui): enable vtpcon strikethrough feature #36762 Problem: Strikethrough was not enabled for vtpcon thus preventing strikethrough text from being shown. Solution: Update `windows.ti`. Co-authored-by: ymich9963 Co-authored-by: Justin M. Keyes --- scripts/windows.ti | 6 ++++-- src/gen/gen_terminfo.lua | 18 +++++++++++++----- src/nvim/tui/terminfo_builtin.h | 4 ++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/scripts/windows.ti b/scripts/windows.ti index a4916a9830..38895cbd7b 100644 --- a/scripts/windows.ti +++ b/scripts/windows.ti @@ -56,7 +56,9 @@ vtpcon|ANSI emulation for console virtual terminal sequence with libuv, kf55@, kf56@, kf57@, kf58@, kf59@, kf60@, kf61@, kf62@, kf63@, kmous@, mc0@, mc4@, mc5@, meml@, memu@, oc@, rmam@, rmcup=\E[?1049l, smcup=\E[?1049h, rmir@, rmkx@, rmm@, rs1@, rs2@, - sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p6%t;1%;m, + smxx=\E[9m, + rmxx=\E[29m, + sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p6%t;1%;%?%p9%t;9%;m, sgr0=\E[0m, smam@, smglp@, smgrp@, smglr@, smir@, smkx@, smm@, tbc@, u6@, u7@, u8@, u9@, Cr@, Cs@, Ms@, XM@, kDC3@, kDC4@, kDC5@, kDC6@, kDC7@, kDN@, kDN3@, kDN4@, kDN5@, kDN6@, kDN7@, @@ -67,5 +69,5 @@ vtpcon|ANSI emulation for console virtual terminal sequence with libuv, kNXT3@, kNXT4@, kNXT5@, kNXT6@, kNXT7@, kPRV3@, kPRV4@, kPRV5@, kPRV6@, kPRV7@, kRIT3@, kRIT4@, kRIT5@, kRIT6@, kRIT7@, - kUP3@, kUP4@, kUP5@, kUP6@, kUP7@, rmxx@, smxx@, xm@, + kUP3@, kUP4@, kUP5@, kUP6@, kUP7@, xm@, use=libuv+basekey, use=libuv+exkey, use=xterm+256color, use=xterm+sl, use=xterm-new, diff --git a/src/gen/gen_terminfo.lua b/src/gen/gen_terminfo.lua index d268b5b81b..dad69a5828 100644 --- a/src/gen/gen_terminfo.lua +++ b/src/gen/gen_terminfo.lua @@ -1,4 +1,12 @@ --- usage: nvim -ll src/gen/gen_terminfo.lua +-- USAGE: +-- +-- # Optional: Delete cache to get latest terminfo from internet. +-- rm -rf /tmp/nvim_terminfo/ +-- +-- # Optional: Ensure the latest ncurses+tic is in your PATH. +-- export PATH="/opt/homebrew/Cellar/ncurses/6.5/bin/":"$PATH" +-- +-- nvim -ll src/gen/gen_terminfo.lua -- -- This script does: -- @@ -111,8 +119,8 @@ if vim.uv.fs_stat(db) == nil then end sys('curl -O ' .. url) sys('gunzip -f terminfo.src.gz') - sys('cat terminfo.src | tic -x -o "' .. db .. '" -') - sys('cat scripts/windows.ti | tic -x -o "' .. db .. '" -') + sys(('cat terminfo.src | tic -x -o "%s" -'):format(db)) + sys(('cat scripts/windows.ti | tic -x -o "%s" -'):format(db)) sys('rm -f terminfo.src') else print('using cached terminfo in ' .. db) @@ -138,7 +146,7 @@ end local dbg = function() end -- dbg = print -local f_enum = io.open(target_enum, 'wb') +local f_enum = assert(io.open(target_enum, 'wb')) f_enum:write('// genenerated by src/gen/gen_terminfo.lua\n\n') f_enum:write('#pragma once\n\n') f_enum:write('typedef enum {\n') @@ -169,7 +177,7 @@ f_enum:write(' kTermKeyCount,\n') f_enum:write('} TerminfoKey;\n') f_enum:close() -local f_defs = io.open(target_gen, 'wb') +local f_defs = assert(io.open(target_gen, 'wb')) f_defs:write('// uncrustify:off\n\n') diff --git a/src/nvim/tui/terminfo_builtin.h b/src/nvim/tui/terminfo_builtin.h index 603a91251d..34f7caab8a 100644 --- a/src/nvim/tui/terminfo_builtin.h +++ b/src/nvim/tui/terminfo_builtin.h @@ -1654,12 +1654,12 @@ static const TerminfoEntry vtpcon_terminfo = { [kTerm_parm_up_cursor] = "\033[%p1%dA", [kTerm_set_a_background] = "\033[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", [kTerm_set_a_foreground] = "\033[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", - [kTerm_set_attributes] = "\033[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p6%t;1%;m", + [kTerm_set_attributes] = "\033[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p6%t;1%;%?%p9%t;9%;m", [kTerm_set_lr_margin] = NULL, [kTerm_to_status_line] = "\033]0;", [kTerm_reset_cursor_style] = "\033[2 q", [kTerm_set_cursor_style] = "\033[%p1%d q", - [kTerm_enter_strikethrough_mode] = NULL, + [kTerm_enter_strikethrough_mode] = "\033[9m", [kTerm_set_rgb_foreground] = NULL, [kTerm_set_rgb_background] = NULL, [kTerm_set_cursor_color] = NULL,