diff options
author | watiko <service@mail.watiko.net> | 2016-02-23 03:01:30 +0900 |
---|---|---|
committer | watiko <service@mail.watiko.net> | 2016-03-06 00:03:46 +0900 |
commit | 3d9e9a92cf292dac807c69e3c046b288df0dfb00 (patch) | |
tree | 00f8beaf47decc6fa44a48979f21b9585d421a82 | |
parent | 43456e43de9cb31775711fb01c5a6bcde16fa23d (diff) | |
download | rneovim-3d9e9a92cf292dac807c69e3c046b288df0dfb00.tar.gz rneovim-3d9e9a92cf292dac807c69e3c046b288df0dfb00.tar.bz2 rneovim-3d9e9a92cf292dac807c69e3c046b288df0dfb00.zip |
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.
https://github.com/vim/vim/commit/6f62fed349bf829da2adb02619dc9acba13c8ab6
-rw-r--r-- | src/nvim/ex_getln.c | 25 | ||||
-rw-r--r-- | src/nvim/ops.c | 37 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
3 files changed, 27 insertions, 37 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 2013e73e27..cffda1ca55 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -2424,20 +2424,17 @@ void restore_cmdline_alloc(char_u *p) xfree(p); } -/* - * paste a yank register into the command line. - * used by CTRL-R command in command-line mode - * insert_reg() can't be used here, because special characters from the - * register contents will be interpreted as commands. - * - * return FAIL for failure, OK otherwise - */ -static int -cmdline_paste ( - int regname, - int literally, /* Insert text literally instead of "as typed" */ - int remcr /* remove trailing CR */ -) +/// Paste a yank register into the command line. +/// Used by CTRL-R command in command-line mode. +/// insert_reg() can't be used here, because special characters from the +/// register contents will be interpreted as commands. +/// +/// @param regname Register name. +/// @param literally Insert text literally instead of "as typed". +/// @param remcr When true, remove trailing CR. +/// +/// @returns FAIL for failure, OK otherwise +static bool cmdline_paste(int regname, bool literally, bool remcr) { long i; char_u *arg; diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 8c7805ba04..5f48fdbf3d 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1261,21 +1261,18 @@ get_spec_reg ( return FALSE; } -/* - * Paste a yank register into the command line. - * Only for non-special registers. - * Used by CTRL-R command in command-line mode - * insert_reg() can't be used here, because special characters from the - * register contents will be interpreted as commands. - * - * return FAIL for failure, OK otherwise - */ -int -cmdline_paste_reg ( - int regname, - int literally, /* Insert text literally instead of "as typed" */ - int remcr /* don't add trailing CR */ -) +/// Paste a yank register into the command line. +/// Only for non-special registers. +/// Used by CTRL-R command in command-line mode +/// insert_reg() can't be used here, because special characters from the +/// register contents will be interpreted as commands. +/// +/// @param regname Register name. +/// @param literally Insert text literally instead of "as typed". +/// @param remcr When true, don't add CR characters. +/// +/// @returns FAIL for failure, OK otherwise +bool cmdline_paste_reg(int regname, bool literally, bool remcr) { long i; @@ -1286,13 +1283,9 @@ cmdline_paste_reg ( for (i = 0; i < reg->y_size; i++) { cmdline_paste_str(reg->y_array[i], literally); - /* 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. */ - if (reg->y_type == MLINE - || (i < reg->y_size - 1 - && !(remcr - && i == reg->y_size - 2 - && *reg->y_array[i + 1] == NUL))) { + // Insert ^M between lines and after last line if type is MLINE. + // Don't do this when "remcr" is true. + if ((reg->y_type == MLINE || i < reg->y_size - 1) && !remcr) { cmdline_paste_str((char_u *)"\r", literally); } diff --git a/src/nvim/version.c b/src/nvim/version.c index 4e875516c0..d3c07c56ce 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -317,7 +317,7 @@ static int included_patches[] = { // 976 NA 975, 974, - // 973, + 973, 972, // 971 NA // 970 NA |