aboutsummaryrefslogtreecommitdiff
path: root/vis-core.h
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-03-19 14:05:32 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-03-19 14:58:07 +0100
commit5166e81e794c0faa80742ad6806745b13b967a51 (patch)
treed2f4cd3ece83311bbea9ea172ea12d8337225fa2 /vis-core.h
parent5fb583f035bb8e699e8980e63050ef1f41f94dd9 (diff)
downloadvis-5166e81e794c0faa80742ad6806745b13b967a51.tar.gz
vis-5166e81e794c0faa80742ad6806745b13b967a51.tar.xz
vis: add infrastructure for user specified operators
Diffstat (limited to 'vis-core.h')
-rw-r--r--vis-core.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/vis-core.h b/vis-core.h
index f182e2a..9cc26f3 100644
--- a/vis-core.h
+++ b/vis-core.h
@@ -37,7 +37,7 @@ struct Mode {
bool visual; /* whether text selection is possible in this mode */
};
-typedef struct {
+struct OperatorContext {
int count; /* how many times should the command be executed? */
Register *reg; /* always non-NULL, set to a default register */
Filerange range; /* which part of the file should be affected by the operator */
@@ -45,12 +45,14 @@ typedef struct {
size_t newpos; /* new position after motion or EPOS if none given */
bool linewise; /* should the changes always affect whole lines? */
const Arg *arg; /* arbitrary arguments */
-} OperatorContext;
+ void *context; /* used by user-registered operators */
+};
typedef struct {
/* operator logic, returns new cursor position, if EPOS is
* the cursor is disposed (except if it is the primary one) */
- size_t (*func)(Vis*, Text*, OperatorContext*);
+ VisOperatorFunction *func;
+ void *context;
} Operator;
typedef struct { /* Motion implementation, takes a cursor postion and returns a new one */
@@ -200,6 +202,7 @@ struct Vis {
Array actions_user; /* dynamically allocated editor actions */
lua_State *lua; /* lua context used for syntax highligthing */
VisEvent *event;
+ Array operators;
Array motions;
Array textobjects;
Array bindings;