aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-02-17 21:34:00 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-02-18 16:50:40 +0100
commit498723377cbf5cdb36d8b64f41b219a515a84175 (patch)
treedbd82e2cc0fe74f7e63859735a4febd14e09cff2 /vis.c
parent55e285783ef99befcc01d7ed6f5594f87d6d8f6c (diff)
downloadvis-498723377cbf5cdb36d8b64f41b219a515a84175.tar.gz
vis-498723377cbf5cdb36d8b64f41b219a515a84175.tar.xz
Add infrastructure to register custom text object functions
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/vis.c b/vis.c
index ccea1f1..0d4fd9d 100644
--- a/vis.c
+++ b/vis.c
@@ -378,6 +378,7 @@ void vis_free(Vis *vis) {
for (int i = 0; i < VIS_MODE_INVALID; i++)
map_free(vis_modes[i].bindings);
array_release_full(&vis->motions);
+ array_release_full(&vis->textobjects);
free(vis);
}
@@ -524,11 +525,13 @@ void action_do(Vis *vis, Action *a) {
else
c.range.start = c.range.end = pos;
for (int i = 0; i < count; i++) {
- Filerange r;
+ Filerange r = text_range_empty();
if (a->textobj->txt)
r = a->textobj->txt(txt, pos);
- else
+ else if (a->textobj->vis)
r = a->textobj->vis(vis, txt, pos);
+ else if (a->textobj->user)
+ r = a->textobj->user(vis, win, a->textobj->data, pos);
if (!text_range_valid(&r))
break;
if (a->textobj->type & OUTER) {