From 44ff1f95ecc14521fb2a1cec67a628140fc46598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 17 Feb 2016 20:59:26 +0100 Subject: 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(...) --- vis.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'vis.h') diff --git a/vis.h b/vis.h index 19cdb43..42bd88a 100644 --- a/vis.h +++ b/vis.h @@ -242,6 +242,7 @@ enum VisMotion { VIS_MOVE_TOTILL_REVERSE, VIS_MOVE_SEARCH_FORWARD, VIS_MOVE_SEARCH_BACKWARD, + VIS_MOVE_LAST, /* denotes the end of all motions */ }; /* set motion to perform, the following take an additional argument: @@ -275,6 +276,12 @@ enum VisMotionType { /* force certain motion to behave in line or character wise mode */ void vis_motion_type(Vis *vis, enum VisMotionType); +/* register a motion function, if positive the return value can be used + * as an id for the vis_motion funntion. A negative return value indicates + * an error */ +int vis_motion_register(Vis*, enum VisMotionType, void *data, + size_t (*motion)(Vis*, Win*, void*, size_t pos)); + enum VisTextObject { VIS_TEXTOBJECT_INNER_WORD, VIS_TEXTOBJECT_OUTER_WORD, -- cgit v1.2.3