mirror of
https://github.com/neovim/neovim.git
synced 2025-11-10 12:35:29 +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:
@@ -507,7 +507,11 @@ void nvim_ui_term_event(uint64_t channel_id, String event, Object value, Error *
|
||||
|
||||
const String termresponse = value.data.string;
|
||||
set_vim_var_string(VV_TERMRESPONSE, termresponse.data, (ptrdiff_t)termresponse.size);
|
||||
apply_autocmds_group(EVENT_TERMRESPONSE, NULL, NULL, false, AUGROUP_ALL, NULL, NULL, &value);
|
||||
|
||||
MAXSIZE_TEMP_DICT(data, 1);
|
||||
PUT_C(data, "sequence", value);
|
||||
apply_autocmds_group(EVENT_TERMRESPONSE, NULL, NULL, false, AUGROUP_ALL, NULL, NULL,
|
||||
&DICT_OBJ(data));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user