Mercurial > vim
comparison src/ops.c @ 7336:4c5f53a60543 v7.4.973
commit https://github.com/vim/vim/commit/6f62fed349bf829da2adb02619dc9acba13c8ab6
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Dec 17 14:04:24 2015 +0100
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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 17 Dec 2015 14:15:04 +0100 |
parents | 9487ea110214 |
children | ad432f8f68fb |
comparison
equal
deleted
inserted
replaced
7335:51ac3ac08833 | 7336:4c5f53a60543 |
---|---|
1575 */ | 1575 */ |
1576 int | 1576 int |
1577 cmdline_paste_reg(regname, literally, remcr) | 1577 cmdline_paste_reg(regname, literally, remcr) |
1578 int regname; | 1578 int regname; |
1579 int literally; /* Insert text literally instead of "as typed" */ | 1579 int literally; /* Insert text literally instead of "as typed" */ |
1580 int remcr; /* don't add trailing CR */ | 1580 int remcr; /* don't add CR characters */ |
1581 { | 1581 { |
1582 long i; | 1582 long i; |
1583 | 1583 |
1584 get_yank_register(regname, FALSE); | 1584 get_yank_register(regname, FALSE); |
1585 if (y_current->y_array == NULL) | 1585 if (y_current->y_array == NULL) |
1588 for (i = 0; i < y_current->y_size; ++i) | 1588 for (i = 0; i < y_current->y_size; ++i) |
1589 { | 1589 { |
1590 cmdline_paste_str(y_current->y_array[i], literally); | 1590 cmdline_paste_str(y_current->y_array[i], literally); |
1591 | 1591 |
1592 /* Insert ^M between lines and after last line if type is MLINE. | 1592 /* Insert ^M between lines and after last line if type is MLINE. |
1593 * Don't do this when "remcr" is TRUE and the next line is empty. */ | 1593 * Don't do this when "remcr" is TRUE. */ |
1594 if (y_current->y_type == MLINE | 1594 if ((y_current->y_type == MLINE || i < y_current->y_size - 1) && !remcr) |
1595 || (i < y_current->y_size - 1 | |
1596 && !(remcr | |
1597 && i == y_current->y_size - 2 | |
1598 && *y_current->y_array[i + 1] == NUL))) | |
1599 cmdline_paste_str((char_u *)"\r", literally); | 1595 cmdline_paste_str((char_u *)"\r", literally); |
1600 | 1596 |
1601 /* Check for CTRL-C, in case someone tries to paste a few thousand | 1597 /* Check for CTRL-C, in case someone tries to paste a few thousand |
1602 * lines and gets bored. */ | 1598 * lines and gets bored. */ |
1603 ui_breakcheck(); | 1599 ui_breakcheck(); |