diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-03-28 07:39:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-28 07:39:36 +0800 |
commit | 4ee9e58056a9d17ce921d8cc6dfd6d3305a40f69 (patch) | |
tree | ba48366c55a17d1a3fd97f79ec738dedae64ed30 /runtime/lua/vim/_defaults.lua | |
parent | 7168000b53eb2da9a910ba038c3aa93822d3f196 (diff) | |
download | rneovim-4ee9e58056a9d17ce921d8cc6dfd6d3305a40f69.tar.gz rneovim-4ee9e58056a9d17ce921d8cc6dfd6d3305a40f69.tar.bz2 rneovim-4ee9e58056a9d17ce921d8cc6dfd6d3305a40f69.zip |
feat(tui): query extended underline support using DECRQSS (#28052)
Diffstat (limited to 'runtime/lua/vim/_defaults.lua')
-rw-r--r-- | runtime/lua/vim/_defaults.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index 91baee1a1e..6223082622 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -384,13 +384,13 @@ if tty then -- attributes, so there should be no attributes in the list. local attrs = vim.split(decrqss, ';') if #attrs ~= 1 and (#attrs ~= 2 or attrs[1] ~= '0') then - return true + return false end -- The returned SGR sequence should begin with 48:2 local sgr = attrs[#attrs]:match('^48:2:([%d:]+)$') if not sgr then - return true + return false end -- The remaining elements of the SGR sequence should be the 3 colors @@ -422,7 +422,8 @@ if tty then if os.getenv('TMUX') then decrqss = string.format('\027Ptmux;%s\027\\', decrqss:gsub('\027', '\027\027')) end - io.stdout:write(string.format('\027[48;2;%d;%d;%dm%s', r, g, b, decrqss)) + -- Reset attributes first, as other code may have set attributes. + io.stdout:write(string.format('\027[0m\027[48;2;%d;%d;%dm%s', r, g, b, decrqss)) timer:start(1000, 0, function() -- Delete the autocommand if no response was received |