aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-10-27 16:21:46 +0100
committerMarc André Tanner <mat@brain-dump.org>2014-10-27 16:21:46 +0100
commitadd639d3be1e2200926bf5257f39ae972c503cc9 (patch)
tree603958a26d8ab5be0b88e2fadd9587441143a4db
parent145fec60076dd7255ff2185e667796c7c47e2edf (diff)
downloadvis-add639d3be1e2200926bf5257f39ae972c503cc9.tar.gz
vis-add639d3be1e2200926bf5257f39ae972c503cc9.tar.xz
Also join lines if cursor is at beginning of a line
-rw-r--r--vis.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/vis.c b/vis.c
index 4d6b2f6..fb7ea0c 100644
--- a/vis.c
+++ b/vis.c
@@ -642,8 +642,9 @@ static void op_repeat_insert(OperatorContext *c) {
static void op_join(OperatorContext *c) {
Text *txt = vis->win->text;
size_t pos = text_line_begin(txt, c->range.end), prev_pos;
- /* if range ends at the begin of a line, skip line break */
- if (pos == c->range.end)
+ Filerange sel = window_selection_get(vis->win->win);
+ /* if a selection ends at the begin of a line, skip line break */
+ if (pos == c->range.end && text_range_valid(&sel))
pos = text_line_prev(txt, pos);
do {