aboutsummaryrefslogtreecommitdiff
path: root/vis-core.h
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-02-17 20:59:26 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-02-18 16:50:40 +0100
commit44ff1f95ecc14521fb2a1cec67a628140fc46598 (patch)
tree61e5439273640ebd33747637d6e8359a1dee056b /vis-core.h
parent58df45177a7db63223c8459be7aef727a0cc22f7 (diff)
downloadvis-44ff1f95ecc14521fb2a1cec67a628140fc46598.tar.gz
vis-44ff1f95ecc14521fb2a1cec67a628140fc46598.tar.xz
Add infrastructure to add custom motion functions
A motion function can be registered with vis_motion_register(...) the returned id (if non negative) can then be used as an argument to vis_motion(...)
Diffstat (limited to 'vis-core.h')
-rw-r--r--vis-core.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/vis-core.h b/vis-core.h
index a201828..b1330c7 100644
--- a/vis-core.h
+++ b/vis-core.h
@@ -8,6 +8,7 @@
#include "text-regex.h"
#include "map.h"
#include "ring-buffer.h"
+#include "array.h"
/* a mode contains a set of key bindings which are currently valid.
*
@@ -59,6 +60,7 @@ typedef struct { /* Motion implementation, takes a cursor postion and returns a
size_t (*vis)(Vis*, Text*, size_t pos);
size_t (*view)(Vis*, View*);
size_t (*win)(Vis*, Win*, size_t pos);
+ size_t (*user)(Vis*, Win*, void*, size_t pos);
enum {
LINEWISE = VIS_MOTIONTYPE_LINEWISE, /* should the covered range be extended to whole lines? */
CHARWISE = VIS_MOTIONTYPE_CHARWISE, /* scrolls window content until position is visible */
@@ -66,6 +68,7 @@ typedef struct { /* Motion implementation, takes a cursor postion and returns a
IDEMPOTENT = 1 << 3, /* does the returned postion remain the same if called multiple times? */
JUMP = 1 << 4,
} type;
+ void *data;
} Movement;
typedef struct {
@@ -165,6 +168,7 @@ struct Vis {
Map *actions; /* registered editor actions / special keys commands */
lua_State *lua; /* lua context used for syntax highligthing */
VisEvent *event;
+ Array motions;
};
/** stuff used by multiple of the vis-* files */