aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_defaults.lua
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2024-02-26 11:33:16 -0600
committerGitHub <noreply@github.com>2024-02-26 11:33:16 -0600
commita8e4ee2f2b4392e959b31c1d079166e245a401ba (patch)
tree2a1ac364d63183192d75cbd31bc1b21bb47dc16e /runtime/lua/vim/_defaults.lua
parent7038fdeee2561ef29bd41e3f5ac54823c76d8143 (diff)
downloadrneovim-a8e4ee2f2b4392e959b31c1d079166e245a401ba.tar.gz
rneovim-a8e4ee2f2b4392e959b31c1d079166e245a401ba.tar.bz2
rneovim-a8e4ee2f2b4392e959b31c1d079166e245a401ba.zip
fix(defaults): validate 'channel' before responding to OSC request (#27594)
Validate the channel number before responding to an OSC 10/11 request. When used with nvim_open_term, the channel number is unset (since there is no process on the other side of the PTY).
Diffstat (limited to 'runtime/lua/vim/_defaults.lua')
-rw-r--r--runtime/lua/vim/_defaults.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua
index 32534a89b4..7cece41ed3 100644
--- a/runtime/lua/vim/_defaults.lua
+++ b/runtime/lua/vim/_defaults.lua
@@ -143,6 +143,10 @@ do
group = nvim_terminal_augroup,
desc = 'Respond to OSC foreground/background color requests',
callback = function(args)
+ local channel = vim.bo[args.buf].channel
+ if channel == 0 then
+ return
+ end
local fg_request = args.data == '\027]10;?'
local bg_request = args.data == '\027]11;?'
if fg_request or bg_request then
@@ -157,7 +161,6 @@ do
end
local command = fg_request and 10 or 11
local data = string.format('\027]%d;rgb:%04x/%04x/%04x\007', command, red, green, blue)
- local channel = vim.bo[args.buf].channel
vim.api.nvim_chan_send(channel, data)
end
end,