From 0267540985d98c006844d9cbdd6f9a0dc3899f0d Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 27 Jul 2013 15:37:28 +0200 Subject: [PATCH] Do not select the first line indent in inner indent select --- src/selectors.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/selectors.cc b/src/selectors.cc index f112a6097..fb478e506 100644 --- a/src/selectors.cc +++ b/src/selectors.cc @@ -530,7 +530,21 @@ Selection select_whole_indent(const Buffer& buffer, const Selection& selection, ++end_line; } --end_line; - return Selection{begin_line, {end_line, buffer[end_line].length() - 1}}; + BufferCoord first = begin_line; + // keep the first line indent in inner mode + if (flags & ObjectFlags::Inner) + { + CharCount i = 0; + for (; i < indent; ++first.column) + { + auto c = buffer.byte_at(first); + if (c == ' ') + ++i; + if (c == '\t') + i = (i / tabstop + 1) * tabstop; + } + } + return Selection{first, {end_line, buffer[end_line].length() - 1}}; } Selection select_whole_lines(const Buffer& buffer, const Selection& selection)