mirror of
https://github.com/neovim/neovim.git
synced 2026-02-07 04:17:22 +00:00
feat(terminal)!: include cursor position in TermRequest event data (#31609)
When a plugin registers a TermRequest handler there is currently no way for the handler to know where the terminal's cursor position was when the sequence was received. This is often useful information, e.g. for OSC 133 sequences which are used to annotate shell prompts. Modify the event data for the TermRequest autocommand to be a table instead of just a string. The "sequence" field of the table contains the sequence string and the "cursor" field contains the cursor position when the sequence was received. To maintain consistency between TermRequest and TermResponse (and to future proof the latter), TermResponse's event data is also updated to be a table with a "sequence" field. BREAKING CHANGE: event data for TermRequest and TermResponse is now a table
This commit is contained in:
@@ -515,8 +515,8 @@ do
|
||||
if channel == 0 then
|
||||
return
|
||||
end
|
||||
local fg_request = args.data == '\027]10;?'
|
||||
local bg_request = args.data == '\027]11;?'
|
||||
local fg_request = args.data.sequence == '\027]10;?'
|
||||
local bg_request = args.data.sequence == '\027]11;?'
|
||||
if fg_request or bg_request then
|
||||
-- WARN: This does not return the actual foreground/background color,
|
||||
-- but rather returns:
|
||||
@@ -712,7 +712,7 @@ do
|
||||
nested = true,
|
||||
desc = "Update the value of 'background' automatically based on the terminal emulator's background color",
|
||||
callback = function(args)
|
||||
local resp = args.data ---@type string
|
||||
local resp = args.data.sequence ---@type string
|
||||
local r, g, b = parseosc11(resp)
|
||||
if r and g and b then
|
||||
local rr = parsecolor(r)
|
||||
@@ -788,7 +788,7 @@ do
|
||||
group = group,
|
||||
nested = true,
|
||||
callback = function(args)
|
||||
local resp = args.data ---@type string
|
||||
local resp = args.data.sequence ---@type string
|
||||
local decrqss = resp:match('^\027P1%$r([%d;:]+)m$')
|
||||
|
||||
if decrqss then
|
||||
|
||||
Reference in New Issue
Block a user