From f9779facca2cb9c8115aa1cbdd2fb71d105b8ebf Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Tue, 18 May 2021 22:53:53 +0100 Subject: vim-patch:8.2.0924: cannot save and restore a register properly Problem: Cannot save and restore a register properly. Solution: Add getreginfo() and make setreg() accept a dictionary. (Andy Massimino, closes vim/vim#3370) https://github.com/vim/vim/commit/bb861e293e0170455184079fa537278754b07911 Cherry-pick eval.txt changes for getreginfo() from: https://github.com/vim/vim/commit/6aa57295cfbe8f21c15f0671e45fd53cf990d404 https://github.com/vim/vim/commit/207f009326c8f878defde0e594d7d9ed9860106e --- src/nvim/ops.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/nvim/ops.c') diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 12fb8439f1..15f63c3179 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -804,12 +804,6 @@ bool valid_yank_reg(int regname, bool writing) return false; } -typedef enum { - YREG_PASTE, - YREG_YANK, - YREG_PUT, -} yreg_mode_t; - /// Return yankreg_T to use, according to the value of `regname`. /// Cannot handle the '_' (black hole) register. /// Must only be called with a valid register name! @@ -3650,6 +3644,12 @@ int get_register_name(int num) } } +/// @return the index of the register "" points to. +int get_unname_register(void) +{ + return y_previous == NULL ? -1 : (int)(y_previous - &y_regs[0]); +} + /* * ":dis" and ":registers": Display the contents of the yank registers. */ -- cgit