From add639d3be1e2200926bf5257f39ae972c503cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 27 Oct 2014 16:21:46 +0100 Subject: Also join lines if cursor is at beginning of a line --- vis.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'vis.c') 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 { -- cgit v1.2.3