From 2c8fcaa8fbb17b99aa5b0f8bfbbe0451dfa509f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 19 Apr 2017 13:11:52 +0200 Subject: vis: restructure register handling Decouple register content from cursors. Previously each cursor had exactly one corresponding register. Now each register can save a list of values whose lifetime is not tied to the cursor. If multiple cursors exist and a put with a register holding only a single value is performed, then this value is inserted at every cursor location. If there are fewer values available than cursors, then only the matching ones will be used. If a register holding multiple values is inserted in a single cursor context, only the first value will be used. Another option would be to join all existing values. The details of this behavior might be changed in the future. in insert mode has not yet been adapted and register handling in general needs to be cleaned up further. Fix #527 --- vis-core.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'vis-core.h') diff --git a/vis-core.h b/vis-core.h index 654085d..b0caee1 100644 --- a/vis-core.h +++ b/vis-core.h @@ -10,6 +10,7 @@ #include "map.h" #include "ring-buffer.h" #include "array.h" +#include "buffer.h" /* a mode contains a set of key bindings which are currently valid. * @@ -40,6 +41,7 @@ struct Mode { struct OperatorContext { int count; /* how many times should the command be executed? */ Register *reg; /* always non-NULL, set to a default register */ + size_t reg_slot; /* register slot to use */ Filerange range; /* which part of the file should be affected by the operator */ size_t pos; /* at which byte from the start of the file should the operation start? */ size_t newpos; /* new position after motion or EPOS if none given */ @@ -248,6 +250,7 @@ void action_reset(Action*); size_t vis_text_insert_nl(Vis*, Text*, size_t pos); void mode_set(Vis *vis, Mode *new_mode); +Macro *macro_get(Vis *vis, enum VisRegister); void window_selection_save(Win *win); Win *window_new_file(Vis*, File*, enum UiOption); -- cgit v1.2.3