patch 8.0.1394: cannot intercept a yank command
Problem: Cannot intercept a yank command.
Solution: Add the TextYankPost autocommand event. (Philippe Vaucher et al.,
closes #2333)
diff --git a/src/fileio.c b/src/fileio.c
index fb49f28..ba9ec9e 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -6478,6 +6478,7 @@
/*
* Like fgets(), but if the file line is too long, it is truncated and the
* rest of the line is thrown away. Returns TRUE for end-of-file.
+ * If the line is truncated then buf[size - 2] will not be NUL.
*/
int
vim_fgets(char_u *buf, int size, FILE *fp)
@@ -7856,6 +7857,7 @@
{"WinEnter", EVENT_WINENTER},
{"WinLeave", EVENT_WINLEAVE},
{"VimResized", EVENT_VIMRESIZED},
+ {"TextYankPost", EVENT_TEXTYANKPOST},
{NULL, (event_T)0}
};
@@ -9400,6 +9402,15 @@
}
/*
+ * Return TRUE when there is a TextYankPost autocommand defined.
+ */
+ int
+has_textyankpost(void)
+{
+ return (first_autopat[(int)EVENT_TEXTYANKPOST] != NULL);
+}
+
+/*
* Execute autocommands for "event" and file name "fname".
* Return TRUE if some commands were executed.
*/