vim-patch:8.0.1587: inserting from the clipboard doesn't work literally
Problem: inserting from the clipboard doesn't work literally
Solution: When pasting from the * or + register always assume literally.
3324d0a864
This commit is contained in:
parent
607240a8ba
commit
4de2957a99
|
@ -842,6 +842,15 @@ static bool is_append_register(int regname)
|
|||
return ASCII_ISUPPER(regname);
|
||||
}
|
||||
|
||||
/// @see get_yank_register
|
||||
/// @returns true when register should be inserted literally
|
||||
/// (selection or clipboard)
|
||||
static inline bool is_literal_register(int regname)
|
||||
FUNC_ATTR_CONST
|
||||
{
|
||||
return regname == '*' || regname == '+';
|
||||
}
|
||||
|
||||
/// Returns a copy of contents in register `name`
|
||||
/// for use in do_put. Should be freed by caller.
|
||||
yankreg_T *copy_register(int name)
|
||||
|
@ -1152,11 +1161,12 @@ static int put_in_typebuf(
|
|||
*/
|
||||
int insert_reg(
|
||||
int regname,
|
||||
int literally /* insert literally, not as if typed */
|
||||
bool literally_arg // insert literally, not as if typed
|
||||
)
|
||||
{
|
||||
int retval = OK;
|
||||
bool allocated;
|
||||
const bool literally = literally_arg || is_literal_register(regname);
|
||||
|
||||
/*
|
||||
* It is possible to get into an endless loop by having CTRL-R a in
|
||||
|
@ -1326,12 +1336,14 @@ bool get_spec_reg(
|
|||
/// register contents will be interpreted as commands.
|
||||
///
|
||||
/// @param regname Register name.
|
||||
/// @param literally Insert text literally instead of "as typed".
|
||||
/// @param literally_arg 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)
|
||||
bool cmdline_paste_reg(int regname, bool literally_arg, bool remcr)
|
||||
{
|
||||
const bool literally = literally_arg || is_literal_register(regname);
|
||||
|
||||
yankreg_T *reg = get_yank_register(regname, YREG_PASTE);
|
||||
if (reg->y_array == NULL)
|
||||
return FAIL;
|
||||
|
|
Loading…
Reference in New Issue