diff src/fileio.c @ 13037:6e81a68d63a1 v8.0.1394

patch 8.0.1394: cannot intercept a yank command commit https://github.com/vim/vim/commit/7e1652c63c96585b9e2235c195a3c322b1f11595 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 16 18:27:02 2017 +0100 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)
author Christian Brabandt <cb@256bit.org>
date Sat, 16 Dec 2017 18:30:05 +0100
parents e7ec107f6354
children 59a16624400a
line wrap: on
line diff
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -6478,6 +6478,7 @@ buf_modname(
 /*
  * 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 @@ static struct event_name
     {"WinEnter",	EVENT_WINENTER},
     {"WinLeave",	EVENT_WINLEAVE},
     {"VimResized",	EVENT_VIMRESIZED},
+    {"TextYankPost",	EVENT_TEXTYANKPOST},
     {NULL,		(event_T)0}
 };
 
@@ -9400,6 +9402,15 @@ has_funcundefined(void)
 }
 
 /*
+ * 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.
  */