From 498723377cbf5cdb36d8b64f41b219a515a84175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 17 Feb 2016 21:34:00 +0100 Subject: Add infrastructure to register custom text object functions --- vis.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'vis.c') 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) { -- cgit v1.2.3