mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
feat(autocmd): populate v:event in RecordingLeave (#16828)
This commit is contained in:
@@ -915,10 +915,29 @@ int do_record(int c)
|
||||
apply_autocmds(EVENT_RECORDINGENTER, NULL, NULL, false, curbuf);
|
||||
}
|
||||
} else { // stop recording
|
||||
save_v_event_T save_v_event;
|
||||
// Set the v:event dictionary with information about the recording.
|
||||
dict_T *dict = get_v_event(&save_v_event);
|
||||
|
||||
// The recorded text contents.
|
||||
p = get_recorded();
|
||||
if (p != NULL) {
|
||||
// Remove escaping for CSI and K_SPECIAL in multi-byte chars.
|
||||
vim_unescape_csi(p);
|
||||
(void)tv_dict_add_str(dict, S_LEN("regcontents"), (const char *)p);
|
||||
}
|
||||
|
||||
// Name of requested register, or empty string for unnamed operation.
|
||||
char buf[NUMBUFLEN+2];
|
||||
buf[0] = (char)regname;
|
||||
buf[1] = NUL;
|
||||
(void)tv_dict_add_str(dict, S_LEN("regname"), buf);
|
||||
|
||||
// Get the recorded key hits. K_SPECIAL and CSI will be escaped, this
|
||||
// needs to be removed again to put it in a register. exec_reg then
|
||||
// adds the escaping back later.
|
||||
apply_autocmds(EVENT_RECORDINGLEAVE, NULL, NULL, false, curbuf);
|
||||
restore_v_event(dict, &save_v_event);
|
||||
reg_recorded = reg_recording;
|
||||
reg_recording = 0;
|
||||
if (ui_has(kUIMessages)) {
|
||||
@@ -926,13 +945,9 @@ int do_record(int c)
|
||||
} else {
|
||||
msg("");
|
||||
}
|
||||
p = get_recorded();
|
||||
if (p == NULL) {
|
||||
retval = FAIL;
|
||||
} else {
|
||||
// Remove escaping for CSI and K_SPECIAL in multi-byte chars.
|
||||
vim_unescape_csi(p);
|
||||
|
||||
// We don't want to change the default register here, so save and
|
||||
// restore the current register name.
|
||||
old_y_previous = y_previous;
|
||||
|
Reference in New Issue
Block a user