vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit d899e718a69a593f55a7b0b0ef69fecd03abfa32
parent 99439bd1e12b9d74a83ddf83eab85d799e629925
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 14 Jan 2016 21:21:49 +0100

vis: s/ops/vis_operators/g

Diffstat:
Mvis-core.h | 2+-
Mvis-modes.c | 4++--
Mvis-motions.c | 4++--
Mvis-operators.c | 6+++---
Mvis.c | 12++++++------
5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/vis-core.h b/vis-core.h @@ -169,7 +169,7 @@ extern Mode vis_modes[VIS_MODE_INVALID]; extern Movement moves[VIS_MOVE_INVALID]; -extern Operator ops[VIS_OP_INVALID]; +extern Operator vis_operators[VIS_OP_INVALID]; extern TextObject vis_textobjects[VIS_TEXTOBJECT_INVALID]; void action_do(Vis *vis, Action *a); diff --git a/vis-modes.c b/vis-modes.c @@ -95,7 +95,7 @@ static void vis_mode_insert_enter(Vis *vis, Mode *old) { macro_operator_record(vis); action_reset(&vis->action_prev); vis->action_prev.macro = vis->macro_operator; - vis->action_prev.op = &ops[VIS_OP_INSERT]; + vis->action_prev.op = &vis_operators[VIS_OP_INSERT]; } } @@ -119,7 +119,7 @@ static void vis_mode_replace_enter(Vis *vis, Mode *old) { macro_operator_record(vis); action_reset(&vis->action_prev); vis->action_prev.macro = vis->macro_operator; - vis->action_prev.op = &ops[VIS_OP_REPLACE]; + vis->action_prev.op = &vis_operators[VIS_OP_REPLACE]; } } diff --git a/vis-motions.c b/vis-motions.c @@ -174,11 +174,11 @@ bool vis_motion(Vis *vis, enum VisMotion motion, ...) { switch (motion) { case VIS_MOVE_WORD_START_NEXT: - if (vis->action.op == &ops[VIS_OP_CHANGE]) + if (vis->action.op == &vis_operators[VIS_OP_CHANGE]) motion = VIS_MOVE_WORD_END_NEXT; break; case VIS_MOVE_LONGWORD_START_NEXT: - if (vis->action.op == &ops[VIS_OP_CHANGE]) + if (vis->action.op == &vis_operators[VIS_OP_CHANGE]) motion = VIS_MOVE_LONGWORD_END_NEXT; break; case VIS_MOVE_SEARCH_FORWARD: diff --git a/vis-operators.c b/vis-operators.c @@ -242,9 +242,9 @@ bool vis_operator(Vis *vis, enum VisOperator id, ...) { default: break; } - if (id >= LENGTH(ops)) + if (id >= LENGTH(vis_operators)) goto err; - Operator *op = &ops[id]; + Operator *op = &vis_operators[id]; if (vis->mode->visual) { vis->action.op = op; action_do(vis, &vis->action); @@ -275,7 +275,7 @@ err: return false; } -Operator ops[] = { +Operator vis_operators[] = { [VIS_OP_DELETE] = { op_delete }, [VIS_OP_CHANGE] = { op_change }, [VIS_OP_YANK] = { op_yank }, diff --git a/vis.c b/vis.c @@ -582,7 +582,7 @@ void action_do(Vis *vis, Action *a) { Text *txt = win->file->text; View *view = win->view; - if (a->op == &ops[VIS_OP_FILTER] && !vis->mode->visual) + if (a->op == &vis_operators[VIS_OP_FILTER] && !vis->mode->visual) vis_mode_switch(vis, VIS_MODE_VISUAL_LINE); if (a->count < 1) @@ -704,11 +704,11 @@ void action_do(Vis *vis, Action *a) { /* operator implementations must not change the mode, * they might get called multiple times (once for every cursor) */ - if (a->op == &ops[VIS_OP_INSERT] || a->op == &ops[VIS_OP_CHANGE]) { + if (a->op == &vis_operators[VIS_OP_INSERT] || a->op == &vis_operators[VIS_OP_CHANGE]) { vis_mode_switch(vis, VIS_MODE_INSERT); - } else if (a->op == &ops[VIS_OP_REPLACE]) { + } else if (a->op == &vis_operators[VIS_OP_REPLACE]) { vis_mode_switch(vis, VIS_MODE_REPLACE); - } else if (a->op == &ops[VIS_OP_FILTER]) { + } else if (a->op == &vis_operators[VIS_OP_FILTER]) { if (a->arg.s) { vis_mode_switch(vis, VIS_MODE_NORMAL); vis_cmd(vis, a->arg.s); @@ -1108,7 +1108,7 @@ void vis_repeat(Vis *vis) { vis->action_prev.count = count; count = vis->action_prev.count; /* for some operators count should be applied only to the macro not the motion */ - if (vis->action_prev.op == &ops[VIS_OP_INSERT] || vis->action_prev.op == &ops[VIS_OP_REPLACE]) + if (vis->action_prev.op == &vis_operators[VIS_OP_INSERT] || vis->action_prev.op == &vis_operators[VIS_OP_REPLACE]) vis->action_prev.count = 1; action_do(vis, &vis->action_prev); vis->action_prev.count = count; @@ -1116,7 +1116,7 @@ void vis_repeat(Vis *vis) { Mode *mode = vis->mode; Action action_prev = vis->action_prev; count = action_prev.count; - if (count < 1 || action_prev.op == &ops[VIS_OP_CHANGE] || action_prev.op == &ops[VIS_OP_FILTER]) + if (count < 1 || action_prev.op == &vis_operators[VIS_OP_CHANGE] || action_prev.op == &vis_operators[VIS_OP_FILTER]) count = 1; for (int i = 0; i < count; i++) { mode_set(vis, mode);