From 7ce4e0cc1423bb55f798031014462fd192d23fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Fri, 27 Nov 2015 07:23:36 +0100 Subject: vis: implement filter operator ! It currently works by switching to visual mode and then opening the command prompt with a default range which refers to the currently active selection. --- vis-operators.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'vis-operators.c') diff --git a/vis-operators.c b/vis-operators.c index 981922b..e93f946 100644 --- a/vis-operators.c +++ b/vis-operators.c @@ -204,6 +204,11 @@ static size_t op_replace(Vis *vis, Text *txt, OperatorContext *c) { return c->newpos != EPOS ? c->newpos : c->pos; } +static size_t op_filter(Vis *vis, Text *txt, OperatorContext *c) { + macro_operator_record(vis); + return text_size(txt) + 1; /* do not change cursor position, would destroy selection */ +} + Operator ops[] = { [VIS_OP_DELETE] = { op_delete }, [VIS_OP_CHANGE] = { op_change }, @@ -216,4 +221,5 @@ Operator ops[] = { [VIS_OP_INSERT] = { op_insert }, [VIS_OP_REPLACE] = { op_replace }, [VIS_OP_CURSOR_SOL] = { op_cursor }, + [VIS_OP_FILTER] = { op_filter }, }; -- cgit v1.2.3