aboutsummaryrefslogtreecommitdiff
path: root/vis-motions.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2020-12-28 14:40:26 +0100
committerMarc André Tanner <mat@brain-dump.org>2020-12-28 14:51:59 +0100
commit0b082239bc60f0a6a3cb743b38a63684652ae649 (patch)
tree0195fad9b9f4588601fd4980e4c11c1acf14064e /vis-motions.c
parent41b235584feeb492d082cdc7bbb735cc49b08180 (diff)
downloadvis-0b082239bc60f0a6a3cb743b38a63684652ae649.tar.gz
vis-0b082239bc60f0a6a3cb743b38a63684652ae649.tar.xz
vis: rename to/till motion internals
This renames the functions and constants implementing the to/till motions. The new names should indicate that matches are only returned within the current line (not globally). Apart from the changed virtual key/command name this contains no functional changes.
Diffstat (limited to 'vis-motions.c')
-rw-r--r--vis-motions.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/vis-motions.c b/vis-motions.c
index 3702efa..9658f9f 100644
--- a/vis-motions.c
+++ b/vis-motions.c
@@ -112,7 +112,7 @@ static size_t longword_next(Vis *vis, Text *txt, size_t pos) {
VIS_MOVE_LONGWORD_END_NEXT, isspace);
}
-static size_t to(Vis *vis, Text *txt, size_t pos) {
+static size_t to_line_right(Vis *vis, Text *txt, size_t pos) {
char c;
if (pos == text_line_end(txt, pos))
return pos;
@@ -122,8 +122,8 @@ static size_t to(Vis *vis, Text *txt, size_t pos) {
return hit;
}
-static size_t till(Vis *vis, Text *txt, size_t pos) {
- size_t hit = to(vis, txt, pos+1);
+static size_t till_line_right(Vis *vis, Text *txt, size_t pos) {
+ size_t hit = to_line_right(vis, txt, pos+1);
if (pos == text_line_end(txt, pos))
return pos;
if (hit != pos)
@@ -131,14 +131,14 @@ static size_t till(Vis *vis, Text *txt, size_t pos) {
return pos;
}
-static size_t to_left(Vis *vis, Text *txt, size_t pos) {
+static size_t to_line_left(Vis *vis, Text *txt, size_t pos) {
return text_line_find_prev(txt, pos, vis->search_char);
}
-static size_t till_left(Vis *vis, Text *txt, size_t pos) {
+static size_t till_line_left(Vis *vis, Text *txt, size_t pos) {
if (pos == text_line_begin(txt, pos))
return pos;
- size_t hit = to_left(vis, txt, pos-1);
+ size_t hit = to_line_left(vis, txt, pos-1);
if (hit != pos-1)
return text_char_next(txt, hit);
return pos;
@@ -294,10 +294,10 @@ bool vis_motion(Vis *vis, enum VisMotion motion, ...) {
}
break;
}
- case VIS_MOVE_RIGHT_TO:
- case VIS_MOVE_LEFT_TO:
- case VIS_MOVE_RIGHT_TILL:
- case VIS_MOVE_LEFT_TILL:
+ case VIS_MOVE_TO_LINE_RIGHT:
+ case VIS_MOVE_TO_LINE_LEFT:
+ case VIS_MOVE_TILL_LINE_RIGHT:
+ case VIS_MOVE_TILL_LINE_LEFT:
{
const char *key = va_arg(ap, char*);
if (!key)
@@ -314,17 +314,17 @@ bool vis_motion(Vis *vis, enum VisMotion motion, ...) {
break;
case VIS_MOVE_TOTILL_REVERSE:
switch (vis->last_totill) {
- case VIS_MOVE_RIGHT_TO:
- motion = VIS_MOVE_LEFT_TO;
+ case VIS_MOVE_TO_LINE_RIGHT:
+ motion = VIS_MOVE_TO_LINE_LEFT;
break;
- case VIS_MOVE_LEFT_TO:
- motion = VIS_MOVE_RIGHT_TO;
+ case VIS_MOVE_TO_LINE_LEFT:
+ motion = VIS_MOVE_TO_LINE_RIGHT;
break;
- case VIS_MOVE_RIGHT_TILL:
- motion = VIS_MOVE_LEFT_TILL;
+ case VIS_MOVE_TILL_LINE_RIGHT:
+ motion = VIS_MOVE_TILL_LINE_LEFT;
break;
- case VIS_MOVE_LEFT_TILL:
- motion = VIS_MOVE_RIGHT_TILL;
+ case VIS_MOVE_TILL_LINE_LEFT:
+ motion = VIS_MOVE_TILL_LINE_RIGHT;
break;
default:
goto err;
@@ -515,20 +515,20 @@ const Movement vis_motions[] = {
.txt = lastline,
.type = LINEWISE|LINEWISE_INCLUSIVE|JUMP|IDEMPOTENT,
},
- [VIS_MOVE_LEFT_TO] = {
- .vis = to_left,
+ [VIS_MOVE_TO_LINE_LEFT] = {
+ .vis = to_line_left,
.type = COUNT_EXACT,
},
- [VIS_MOVE_RIGHT_TO] = {
- .vis = to,
+ [VIS_MOVE_TO_LINE_RIGHT] = {
+ .vis = to_line_right,
.type = INCLUSIVE|COUNT_EXACT,
},
- [VIS_MOVE_LEFT_TILL] = {
- .vis = till_left,
+ [VIS_MOVE_TILL_LINE_LEFT] = {
+ .vis = till_line_left,
.type = COUNT_EXACT,
},
- [VIS_MOVE_RIGHT_TILL] = {
- .vis = till,
+ [VIS_MOVE_TILL_LINE_RIGHT] = {
+ .vis = till_line_right,
.type = INCLUSIVE|COUNT_EXACT,
},
[VIS_MOVE_SEARCH_WORD_FORWARD] = {