4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: When pasting a while line on the command line an extra CR is added
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
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
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));
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));
39 if (c != ESC) /* use ESC to cancel inserting register */
41 ! cmdline_paste(c, i == Ctrl_R);
44 /* When there was a serious error abort getting the
47 if (c != ESC) /* use ESC to cancel inserting register */
49 ! cmdline_paste(c, i == Ctrl_R, FALSE);
52 /* When there was a serious error abort getting the
55 goto cmdline_not_changed; /* Ignore mouse */
56 # ifdef FEAT_CLIPBOARD
57 if (clip_star.available)
58 ! cmdline_paste('*', TRUE);
61 ! cmdline_paste(0, TRUE);
67 ! cmdline_paste('~', TRUE);
72 goto cmdline_not_changed; /* Ignore mouse */
73 # ifdef FEAT_CLIPBOARD
74 if (clip_star.available)
75 ! cmdline_paste('*', TRUE, TRUE);
78 ! cmdline_paste(0, TRUE, TRUE);
84 ! cmdline_paste('~', TRUE, FALSE);
90 * return FAIL for failure, OK otherwise
93 ! cmdline_paste(regname, literally)
95 int literally; /* Insert text literally instead of "as typed" */
100 * return FAIL for failure, OK otherwise
103 ! cmdline_paste(regname, literally, remcr)
105 int literally; /* Insert text literally instead of "as typed" */
106 + int remcr; /* remove trailing CR */
115 ! return cmdline_paste_reg(regname, literally);
123 ! return cmdline_paste_reg(regname, literally, remcr);
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
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));
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
150 * return FAIL for failure, OK otherwise
153 ! cmdline_paste_reg(regname, literally)
155 int literally; /* Insert text literally instead of "as typed" */
160 * return FAIL for failure, OK otherwise
163 ! cmdline_paste_reg(regname, literally, remcr)
165 int literally; /* Insert text literally instead of "as typed" */
166 + int remcr; /* don't add trailing CR */
173 cmdline_paste_str(y_current->y_array[i], literally);
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);
179 /* Check for CTRL-C, in case someone tries to paste a few thousand
182 cmdline_paste_str(y_current->y_array[i], literally);
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
189 ! && i == y_current->y_size - 2
190 ! && *y_current->y_array[i + 1] == NUL)))
191 cmdline_paste_str((char_u *)"\r", literally);
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
199 { /* Add new patch number below this line */
205 ERROR 047: Keyboard not found. Press RETURN to continue.
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 ///