diff options
author | Josh Rahm <rahm@google.com> | 2022-08-22 10:02:32 -0600 |
---|---|---|
committer | Josh Rahm <rahm@google.com> | 2022-08-22 10:02:32 -0600 |
commit | deb60257f50dbcc72563df697236db48edbf914c (patch) | |
tree | a9c17c80d2dcf45fd809b4c95248f2e4d6a74e84 /src | |
parent | 242f75745009b3a0a2108d98ce6c02b6e13aac3f (diff) | |
download | rneovim-deb60257f50dbcc72563df697236db48edbf914c.tar.gz rneovim-deb60257f50dbcc72563df697236db48edbf914c.tar.bz2 rneovim-deb60257f50dbcc72563df697236db48edbf914c.zip |
feat(userregs): make the @" register call back into the userreg.
Before this changce, the userregs would not be repeated with @", now
they can be. There is still the problem of repeating with a count does
not call into the userreg, but that would be a lot of work to implement
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ops.c | 8 | ||||
-rw-r--r-- | src/nvim/ops.h | 1 | ||||
-rw-r--r-- | src/nvim/yankmap.c | 1 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 889cc4f5bc..fe1496e2d4 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -995,6 +995,10 @@ yankreg_T *get_yank_register(int regname, int mode) && (regname == 0 || regname == '"' || regname == '*' || regname == '+') && y_previous != NULL) { // in case clipboard not available, paste from previous used register + if (get_userreg(y_previous->name) != -1) { + // If y_previous is a userreg, repeat the userreg copy. + copy_userreg(y_previous, y_previous->name); + } return y_previous; } @@ -3410,10 +3414,6 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags) reg = get_yank_register(regname, YREG_PASTE); } - if (get_userreg(regname) != -1) { - copy_userreg(reg, regname); - } - y_type = reg->y_type; y_width = reg->y_width; y_size = reg->y_size; diff --git a/src/nvim/ops.h b/src/nvim/ops.h index a456d68003..69fc8572cf 100644 --- a/src/nvim/ops.h +++ b/src/nvim/ops.h @@ -90,6 +90,7 @@ typedef struct yankreg { colnr_T y_width; ///< Register width (only valid for y_type == kBlockWise). Timestamp timestamp; ///< Time when register was last modified. dict_T *additional_data; ///< Additional data from ShaDa file. + int name; } yankreg_T; /// Modes for get_yank_register() diff --git a/src/nvim/yankmap.c b/src/nvim/yankmap.c index d9229e015d..c5b8ca8838 100644 --- a/src/nvim/yankmap.c +++ b/src/nvim/yankmap.c @@ -18,6 +18,7 @@ yankreg_T* yankmap_get(yankmap_T* yankmap, int reg) if (ret) { if (! (*ret)) { *ret = xcalloc(sizeof(yankreg_T), 1); + (*ret)->name = reg; } /* Add the back-reference */ |