]>
Commit | Line | Data |
---|---|---|
01d03c47 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.0.038 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.0.038 | |
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 | |
15 | ||
16 | ||
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 | |
19 | *************** | |
20 | *** 84,90 **** | |
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)); | |
28 | --- 84,89 ---- | |
29 | *************** | |
30 | *** 196,202 **** | |
31 | * Return TRUE when undo is allowed. Otherwise give an error message and | |
32 | * return FALSE. | |
33 | */ | |
34 | ! static int | |
35 | undo_allowed() | |
36 | { | |
37 | /* Don't allow changes when 'modifiable' is off. */ | |
38 | --- 195,201 ---- | |
39 | * Return TRUE when undo is allowed. Otherwise give an error message and | |
40 | * return FALSE. | |
41 | */ | |
42 | ! int | |
43 | undo_allowed() | |
44 | { | |
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 | |
48 | *************** | |
49 | *** 4,9 **** | |
50 | --- 4,10 ---- | |
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 | |
60 | *************** | |
61 | *** 8252,8257 **** | |
62 | --- 8252,8263 ---- | |
63 | EMSG(_("E785: complete() can only be used in Insert mode")); | |
64 | return; | |
65 | } | |
66 | + | |
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()) | |
70 | + return; | |
71 | + | |
72 | if (argvars[1].v_type != VAR_LIST || argvars[1].vval.v_list == NULL) | |
73 | { | |
74 | EMSG(_(e_invarg)); | |
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 | |
77 | *************** | |
78 | *** 668,669 **** | |
79 | --- 668,671 ---- | |
80 | { /* Add new patch number below this line */ | |
81 | + /**/ | |
82 | + 38, | |
83 | /**/ | |
84 | ||
85 | -- | |
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 | |
89 | to go around. | |
90 | (Scott Adams - The Dilbert principle) | |
91 | ||
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 /// |