]>
Commit | Line | Data |
---|---|---|
f3c378e8 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.0.141 | |
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.141 | |
11 | Problem: When pasting a while line on the command line an extra CR is added | |
12 | literally. | |
13 | Solution: Don't add the trailing CR when pasting with the mouse. | |
14 | Files: src/ex_getln.c, src/proto/ops.pro, src/ops.c | |
15 | ||
16 | ||
17 | *** ../vim-7.0.140/src/ex_getln.c Thu Sep 14 11:27:12 2006 | |
18 | --- src/ex_getln.c Sun Oct 15 16:17:20 2006 | |
19 | *************** | |
20 | *** 86,92 **** | |
21 | static void draw_cmdline __ARGS((int start, int len)); | |
22 | static void save_cmdline __ARGS((struct cmdline_info *ccp)); | |
23 | static void restore_cmdline __ARGS((struct cmdline_info *ccp)); | |
24 | ! static int cmdline_paste __ARGS((int regname, int literally)); | |
25 | #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) | |
26 | static void redrawcmd_preedit __ARGS((void)); | |
27 | #endif | |
28 | --- 86,92 ---- | |
29 | static void draw_cmdline __ARGS((int start, int len)); | |
30 | static void save_cmdline __ARGS((struct cmdline_info *ccp)); | |
31 | static void restore_cmdline __ARGS((struct cmdline_info *ccp)); | |
32 | ! static int cmdline_paste __ARGS((int regname, int literally, int remcr)); | |
33 | #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) | |
34 | static void redrawcmd_preedit __ARGS((void)); | |
35 | #endif | |
36 | *************** | |
37 | *** 1116,1122 **** | |
38 | #endif | |
39 | if (c != ESC) /* use ESC to cancel inserting register */ | |
40 | { | |
41 | ! cmdline_paste(c, i == Ctrl_R); | |
42 | ||
43 | #ifdef FEAT_EVAL | |
44 | /* When there was a serious error abort getting the | |
45 | --- 1116,1122 ---- | |
46 | #endif | |
47 | if (c != ESC) /* use ESC to cancel inserting register */ | |
48 | { | |
49 | ! cmdline_paste(c, i == Ctrl_R, FALSE); | |
50 | ||
51 | #ifdef FEAT_EVAL | |
52 | /* When there was a serious error abort getting the | |
53 | *************** | |
54 | *** 1231,1246 **** | |
55 | goto cmdline_not_changed; /* Ignore mouse */ | |
56 | # ifdef FEAT_CLIPBOARD | |
57 | if (clip_star.available) | |
58 | ! cmdline_paste('*', TRUE); | |
59 | else | |
60 | # endif | |
61 | ! cmdline_paste(0, TRUE); | |
62 | redrawcmd(); | |
63 | goto cmdline_changed; | |
64 | ||
65 | # ifdef FEAT_DND | |
66 | case K_DROP: | |
67 | ! cmdline_paste('~', TRUE); | |
68 | redrawcmd(); | |
69 | goto cmdline_changed; | |
70 | # endif | |
71 | --- 1231,1246 ---- | |
72 | goto cmdline_not_changed; /* Ignore mouse */ | |
73 | # ifdef FEAT_CLIPBOARD | |
74 | if (clip_star.available) | |
75 | ! cmdline_paste('*', TRUE, TRUE); | |
76 | else | |
77 | # endif | |
78 | ! cmdline_paste(0, TRUE, TRUE); | |
79 | redrawcmd(); | |
80 | goto cmdline_changed; | |
81 | ||
82 | # ifdef FEAT_DND | |
83 | case K_DROP: | |
84 | ! cmdline_paste('~', TRUE, FALSE); | |
85 | redrawcmd(); | |
86 | goto cmdline_changed; | |
87 | # endif | |
88 | *************** | |
89 | *** 2890,2898 **** | |
90 | * return FAIL for failure, OK otherwise | |
91 | */ | |
92 | static int | |
93 | ! cmdline_paste(regname, literally) | |
94 | int regname; | |
95 | int literally; /* Insert text literally instead of "as typed" */ | |
96 | { | |
97 | long i; | |
98 | char_u *arg; | |
99 | --- 2890,2899 ---- | |
100 | * return FAIL for failure, OK otherwise | |
101 | */ | |
102 | static int | |
103 | ! cmdline_paste(regname, literally, remcr) | |
104 | int regname; | |
105 | int literally; /* Insert text literally instead of "as typed" */ | |
106 | + int remcr; /* remove trailing CR */ | |
107 | { | |
108 | long i; | |
109 | char_u *arg; | |
110 | *************** | |
111 | *** 2968,2974 **** | |
112 | return OK; | |
113 | } | |
114 | ||
115 | ! return cmdline_paste_reg(regname, literally); | |
116 | } | |
117 | ||
118 | /* | |
119 | --- 2969,2975 ---- | |
120 | return OK; | |
121 | } | |
122 | ||
123 | ! return cmdline_paste_reg(regname, literally, remcr); | |
124 | } | |
125 | ||
126 | /* | |
127 | *** ../vim-7.0.140/src/proto/ops.pro Sun Apr 30 20:25:07 2006 | |
128 | --- src/proto/ops.pro Tue Oct 17 16:24:08 2006 | |
129 | *************** | |
130 | *** 20,26 **** | |
131 | extern int do_execreg __ARGS((int regname, int colon, int addcr)); | |
132 | extern int insert_reg __ARGS((int regname, int literally)); | |
133 | extern int get_spec_reg __ARGS((int regname, char_u **argp, int *allocated, int errmsg)); | |
134 | ! extern int cmdline_paste_reg __ARGS((int regname, int literally)); | |
135 | extern void adjust_clip_reg __ARGS((int *rp)); | |
136 | extern int op_delete __ARGS((oparg_T *oap)); | |
137 | extern int op_replace __ARGS((oparg_T *oap, int c)); | |
138 | --- 20,26 ---- | |
139 | extern int do_execreg __ARGS((int regname, int colon, int addcr)); | |
140 | extern int insert_reg __ARGS((int regname, int literally)); | |
141 | extern int get_spec_reg __ARGS((int regname, char_u **argp, int *allocated, int errmsg)); | |
142 | ! extern int cmdline_paste_reg __ARGS((int regname, int literally, int remcr)); | |
143 | extern void adjust_clip_reg __ARGS((int *rp)); | |
144 | extern int op_delete __ARGS((oparg_T *oap)); | |
145 | extern int op_replace __ARGS((oparg_T *oap, int c)); | |
146 | *** ../vim-7.0.140/src/ops.c Fri Oct 6 23:33:22 2006 | |
147 | --- src/ops.c Sun Oct 15 16:43:54 2006 | |
148 | *************** | |
149 | *** 1480,1488 **** | |
150 | * return FAIL for failure, OK otherwise | |
151 | */ | |
152 | int | |
153 | ! cmdline_paste_reg(regname, literally) | |
154 | int regname; | |
155 | int literally; /* Insert text literally instead of "as typed" */ | |
156 | { | |
157 | long i; | |
158 | ||
159 | --- 1481,1490 ---- | |
160 | * return FAIL for failure, OK otherwise | |
161 | */ | |
162 | int | |
163 | ! cmdline_paste_reg(regname, literally, remcr) | |
164 | int regname; | |
165 | int literally; /* Insert text literally instead of "as typed" */ | |
166 | + int remcr; /* don't add trailing CR */ | |
167 | { | |
168 | long i; | |
169 | ||
170 | *************** | |
171 | *** 1494,1501 **** | |
172 | { | |
173 | cmdline_paste_str(y_current->y_array[i], literally); | |
174 | ||
175 | ! /* insert ^M between lines and after last line if type is MLINE */ | |
176 | ! if (y_current->y_type == MLINE || i < y_current->y_size - 1) | |
177 | cmdline_paste_str((char_u *)"\r", literally); | |
178 | ||
179 | /* Check for CTRL-C, in case someone tries to paste a few thousand | |
180 | --- 1496,1508 ---- | |
181 | { | |
182 | cmdline_paste_str(y_current->y_array[i], literally); | |
183 | ||
184 | ! /* Insert ^M between lines and after last line if type is MLINE. | |
185 | ! * Don't do this when "remcr" is TRUE and the next line is empty. */ | |
186 | ! if (y_current->y_type == MLINE | |
187 | ! || (i < y_current->y_size - 1 | |
188 | ! && !(remcr | |
189 | ! && i == y_current->y_size - 2 | |
190 | ! && *y_current->y_array[i + 1] == NUL))) | |
191 | cmdline_paste_str((char_u *)"\r", literally); | |
192 | ||
193 | /* Check for CTRL-C, in case someone tries to paste a few thousand | |
194 | *** ../vim-7.0.140/src/version.c Tue Oct 17 15:17:41 2006 | |
195 | --- src/version.c Tue Oct 17 16:22:55 2006 | |
196 | *************** | |
197 | *** 668,669 **** | |
198 | --- 668,671 ---- | |
199 | { /* Add new patch number below this line */ | |
200 | + /**/ | |
201 | + 141, | |
202 | /**/ | |
203 | ||
204 | -- | |
205 | ERROR 047: Keyboard not found. Press RETURN to continue. | |
206 | ||
207 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
208 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
209 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
210 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |