vim-patch:7.4.973

Problem:    When pasting on the command line line breaks result in literal
            <CR> characters. This makes pasting a long file name difficult.
Solution:   Skip the characters.

6f62fed349
This commit is contained in:
watiko
2016-02-23 03:01:30 +09:00
parent 43456e43de
commit 3d9e9a92cf
3 changed files with 27 additions and 37 deletions

View File

@@ -2424,20 +2424,17 @@ void restore_cmdline_alloc(char_u *p)
xfree(p); xfree(p);
} }
/* /// Paste a yank register into the command line.
* paste a yank register into the command line. /// Used by CTRL-R command in command-line mode.
* used by CTRL-R command in command-line mode /// insert_reg() can't be used here, because special characters from the
* insert_reg() can't be used here, because special characters from the /// register contents will be interpreted as commands.
* register contents will be interpreted as commands. ///
* /// @param regname Register name.
* return FAIL for failure, OK otherwise /// @param literally Insert text literally instead of "as typed".
*/ /// @param remcr When true, remove trailing CR.
static int ///
cmdline_paste ( /// @returns FAIL for failure, OK otherwise
int regname, static bool cmdline_paste(int regname, bool literally, bool remcr)
int literally, /* Insert text literally instead of "as typed" */
int remcr /* remove trailing CR */
)
{ {
long i; long i;
char_u *arg; char_u *arg;

View File

@@ -1261,21 +1261,18 @@ get_spec_reg (
return FALSE; return FALSE;
} }
/* /// Paste a yank register into the command line.
* Paste a yank register into the command line. /// Only for non-special registers.
* Only for non-special registers. /// Used by CTRL-R command in command-line mode
* Used by CTRL-R command in command-line mode /// insert_reg() can't be used here, because special characters from the
* insert_reg() can't be used here, because special characters from the /// register contents will be interpreted as commands.
* register contents will be interpreted as commands. ///
* /// @param regname Register name.
* return FAIL for failure, OK otherwise /// @param literally Insert text literally instead of "as typed".
*/ /// @param remcr When true, don't add CR characters.
int ///
cmdline_paste_reg ( /// @returns FAIL for failure, OK otherwise
int regname, bool cmdline_paste_reg(int regname, bool literally, bool remcr)
int literally, /* Insert text literally instead of "as typed" */
int remcr /* don't add trailing CR */
)
{ {
long i; long i;
@@ -1286,13 +1283,9 @@ cmdline_paste_reg (
for (i = 0; i < reg->y_size; i++) { for (i = 0; i < reg->y_size; i++) {
cmdline_paste_str(reg->y_array[i], literally); cmdline_paste_str(reg->y_array[i], literally);
/* Insert ^M between lines and after last line if type is MLINE. // Insert ^M between lines and after last line if type is MLINE.
* Don't do this when "remcr" is TRUE and the next line is empty. */ // Don't do this when "remcr" is true.
if (reg->y_type == MLINE if ((reg->y_type == MLINE || i < reg->y_size - 1) && !remcr) {
|| (i < reg->y_size - 1
&& !(remcr
&& i == reg->y_size - 2
&& *reg->y_array[i + 1] == NUL))) {
cmdline_paste_str((char_u *)"\r", literally); cmdline_paste_str((char_u *)"\r", literally);
} }

View File

@@ -317,7 +317,7 @@ static int included_patches[] = {
// 976 NA // 976 NA
975, 975,
974, 974,
// 973, 973,
972, 972,
// 971 NA // 971 NA
// 970 NA // 970 NA