diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-02-17 20:59:26 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-02-18 16:50:40 +0100 |
| commit | 44ff1f95ecc14521fb2a1cec67a628140fc46598 (patch) | |
| tree | 61e5439273640ebd33747637d6e8359a1dee056b /vis-core.h | |
| parent | 58df45177a7db63223c8459be7aef727a0cc22f7 (diff) | |
| download | vis-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.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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 */ |
