aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-09-24 16:16:30 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-09-24 16:16:30 +0200
commit3a24e6a5562e4b1ea456fbe36607bd8a9c92744d (patch)
treebef2a4f40fbacc6074eab0dc682ff8c3345b3ff7 /vis.c
parent6703eb20d1fd5c05545f8f1360eef3020bb9d8b8 (diff)
downloadvis-3a24e6a5562e4b1ea456fbe36607bd8a9c92744d.tar.gz
vis-3a24e6a5562e4b1ea456fbe36607bd8a9c92744d.tar.xz
Change semantics of text_line_end
Also make movement to end of line inclusive. This has the effect that $ moves to the last character on a line but d$ still deletes said character.
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/vis.c b/vis.c
index eefed59..0a9f7dd 100644
--- a/vis.c
+++ b/vis.c
@@ -263,7 +263,7 @@ static Movement moves[] = {
[MOVE_LINE_BEGIN] = { .txt = text_line_begin, .type = LINEWISE },
[MOVE_LINE_START] = { .txt = text_line_start, .type = LINEWISE },
[MOVE_LINE_FINISH] = { .txt = text_line_finish, .type = LINEWISE },
- [MOVE_LINE_END] = { .txt = text_line_end, .type = LINEWISE },
+ [MOVE_LINE_END] = { .txt = text_line_end, .type = LINEWISE|INCLUSIVE },
[MOVE_LINE_NEXT] = { .txt = text_line_next, .type = LINEWISE },
[MOVE_LINE] = { .cmd = line, .type = LINEWISE|IDEMPOTENT},
[MOVE_COLUMN] = { .cmd = column, .type = CHARWISE|IDEMPOTENT},
@@ -939,7 +939,7 @@ static void joinline(const Arg *arg) {
Text *txt = vis->win->text;
size_t pos = window_cursor_get(vis->win->win), start, end;
if (arg->i == MOVE_LINE_NEXT) {
- start = text_line_end(txt, pos);
+ start = text_line_prev(txt, text_line_next(txt, pos));
end = text_line_next(txt, pos);
} else {
end = text_line_begin(txt, pos);
@@ -1000,7 +1000,7 @@ static void action_do(Action *a) {
Filerange sel = window_selection_get(win);
sel.end = text_char_prev(txt, sel.end);
size_t start = text_line_begin(txt, sel.start);
- size_t end = text_line_end(txt, sel.end);
+ size_t end = text_line_prev(txt, text_line_next(txt, sel.end));
if (sel.start == pos) { /* extend selection upwards */
sel.end = start;
sel.start = end;