vis

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

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

commit 4a5577df5f675576b886ff7d1718938d8869ef27
parent d16016ad641a8ae6eff6fee38591a6a42b0d0660
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Wed, 15 Feb 2017 08:20:48 +0100

text-motions: remove unused text_line_lastchar

Diffstat:
Mmain.c | 6------
Mtext-motions.c | 8--------
Mtext-motions.h | 5++---
Mvis-motions.c | 4----
4 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/main.c b/main.c @@ -155,7 +155,6 @@ enum { VIS_ACTION_CURSOR_LINE_FINISH, VIS_ACTION_CURSOR_LINE_BEGIN, VIS_ACTION_CURSOR_LINE_END, - VIS_ACTION_CURSOR_LINE_LASTCHAR, VIS_ACTION_CURSOR_SCREEN_LINE_UP, VIS_ACTION_CURSOR_SCREEN_LINE_DOWN, VIS_ACTION_CURSOR_SCREEN_LINE_BEGIN, @@ -420,11 +419,6 @@ static const KeyAction vis_action[] = { "Move cursor to end of the line", movement, { .i = VIS_MOVE_LINE_END } }, - [VIS_ACTION_CURSOR_LINE_LASTCHAR] = { - "cursor-line-lastchar", - "Move cursor to last character of the line", - movement, { .i = VIS_MOVE_LINE_LASTCHAR } - }, [VIS_ACTION_CURSOR_SCREEN_LINE_UP] = { "cursor-screenline-up", "Move cursor screen/display line upwards", diff --git a/text-motions.c b/text-motions.c @@ -158,14 +158,6 @@ size_t text_line_finish(Text *txt, size_t pos) { return it.pos; } -size_t text_line_lastchar(Text *txt, size_t pos) { - char c; - Iterator it = text_iterator_get(txt, text_line_end(txt, pos)); - if (text_iterator_char_prev(&it, &c) && c == '\n') - text_iterator_byte_next(&it, NULL); - return it.pos; -} - size_t text_line_end(Text *txt, size_t pos) { char c; Iterator it = text_iterator_get(txt, pos); diff --git a/text-motions.h b/text-motions.h @@ -28,14 +28,13 @@ size_t text_line_find_prev(Text*, size_t pos, const char *s); /* begin finish end next * v v v v * [\r]\n I am a line! [\r]\n - * ^ ^ ^ - * prev start lastchar + * ^ ^ + * prev start */ size_t text_line_prev(Text*, size_t pos); size_t text_line_begin(Text*, size_t pos); size_t text_line_start(Text*, size_t pos); size_t text_line_finish(Text*, size_t pos); -size_t text_line_lastchar(Text*, size_t pos); size_t text_line_end(Text*, size_t pos); size_t text_line_next(Text*, size_t pos); size_t text_line_offset(Text*, size_t pos, size_t off); diff --git a/vis-motions.c b/vis-motions.c @@ -394,10 +394,6 @@ const Movement vis_motions[] = { .txt = text_line_finish, .type = INCLUSIVE, }, - [VIS_MOVE_LINE_LASTCHAR] = { - .txt = text_line_lastchar, - .type = INCLUSIVE, - }, [VIS_MOVE_LINE_END] = { .txt = text_line_end, },