4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: When calling complete() from an Insert mode expression mapping
12 text could be inserted in an improper way.
13 Solution: Make undo_allowed() global and use it in complete().
14 Files: src/undo.c, src/proto/undo.pro, src/eval.c
17 *** ../vim-7.0.037/src/undo.c Sat Apr 22 00:01:05 2006
18 --- src/undo.c Mon Jul 3 22:23:22 2006
21 static void u_unch_branch __ARGS((u_header_T *uhp));
22 static u_entry_T *u_get_headentry __ARGS((void));
23 static void u_getbot __ARGS((void));
24 - static int undo_allowed __ARGS((void));
25 static int u_savecommon __ARGS((linenr_T, linenr_T, linenr_T));
26 static void u_doit __ARGS((int count));
27 static void u_undoredo __ARGS((int undo));
31 * Return TRUE when undo is allowed. Otherwise give an error message and
37 /* Don't allow changes when 'modifiable' is off. */
39 * Return TRUE when undo is allowed. Otherwise give an error message and
45 /* Don't allow changes when 'modifiable' is off. */
46 *** ../vim-7.0.037/src/proto/undo.pro Mon Apr 10 16:38:50 2006
47 --- src/proto/undo.pro Mon Jul 3 22:25:07 2006
51 extern int u_savesub __ARGS((linenr_T lnum));
52 extern int u_inssub __ARGS((linenr_T lnum));
53 extern int u_savedel __ARGS((linenr_T lnum, long nlines));
54 + extern int undo_allowed __ARGS((void));
55 extern void u_undo __ARGS((int count));
56 extern void u_redo __ARGS((int count));
57 extern void undo_time __ARGS((long step, int sec, int absolute));
58 *** ../vim-7.0.037/src/eval.c Thu Jun 22 21:01:19 2006
59 --- src/eval.c Mon Jul 10 23:03:13 2006
63 EMSG(_("E785: complete() can only be used in Insert mode"));
67 + /* Check for undo allowed here, because if something was already inserted
68 + * the line was already saved for undo and this check isn't done. */
69 + if (!undo_allowed())
72 if (argvars[1].v_type != VAR_LIST || argvars[1].vval.v_list == NULL)
75 *** ../vim-7.0.037/src/version.c Tue Jul 11 22:59:04 2006
76 --- src/version.c Wed Jul 12 20:31:49 2006
80 { /* Add new patch number below this line */
86 If someone questions your market projections, simply point out that your
87 target market is "People who are nuts" and "People who will buy any damn
88 thing". Nobody is going to tell you there aren't enough of those people
90 (Scott Adams - The Dilbert principle)
92 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
93 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
94 \\\ download, build and distribute -- http://www.A-A-P.org ///
95 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///