diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-08-31 11:18:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-31 11:18:35 +0200 |
commit | 25e0a449bb6619fc534fa862c2f591657be1e1d5 (patch) | |
tree | bf3d8beff647c8e1e5b39c746088843d629338ef /src/nvim/ops.c | |
parent | 8a03acb8dad4abaf507d502b11a66bd5a2b5e51e (diff) | |
parent | 2c605d1f22a243bc34b680f69c7c8cfe01b80887 (diff) | |
download | rneovim-25e0a449bb6619fc534fa862c2f591657be1e1d5.tar.gz rneovim-25e0a449bb6619fc534fa862c2f591657be1e1d5.tar.bz2 rneovim-25e0a449bb6619fc534fa862c2f591657be1e1d5.zip |
Merge pull request #10878 from bfredl/pastedefer
TUI: defer nvim_paste event properly
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r-- | src/nvim/ops.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index df4452cd4a..bfd02d4ff1 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -5685,9 +5685,6 @@ end: /// @param[out] reg Expected to be empty bool prepare_yankreg_from_object(yankreg_T *reg, String regtype, size_t lines) { - if (regtype.size > 1) { - return false; - } char type = regtype.data ? regtype.data[0] : NUL; switch (type) { @@ -5707,6 +5704,23 @@ bool prepare_yankreg_from_object(yankreg_T *reg, String regtype, size_t lines) return false; } + reg->y_width = 0; + if (regtype.size > 1) { + if (reg->y_type != kMTBlockWise) { + return false; + } + + // allow "b7" for a block at least 7 spaces wide + if (!ascii_isdigit(regtype.data[1])) { + return false; + } + const char *p = regtype.data+1; + reg->y_width = getdigits_int((char_u **)&p)-1; + if (regtype.size > (size_t)(p-regtype.data)) { + return false; + } + } + reg->y_array = xcalloc(lines, sizeof(uint8_t *)); reg->y_size = lines; reg->additional_data = NULL; @@ -5743,7 +5757,7 @@ void finish_yankreg_from_object(yankreg_T *reg, bool clipboard_adjust) } } assert(maxlen <= INT_MAX); - reg->y_width = (int)maxlen - 1; + reg->y_width = MAX(reg->y_width, (int)maxlen - 1); } } |