From 4834504508bdbde70c536bad28260cbaabc6ceec Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 9 Jun 2014 19:26:53 +0100 Subject: [PATCH] Do not touch the reference line in copy_indent --- src/normal.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/normal.cc b/src/normal.cc index 3c78e1f2..d176f527 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1156,15 +1156,19 @@ void copy_indent(Context& context, int selection) if (selection == 0) selection = context.selections().main_index() + 1; - const String& line = buffer[selections[selection-1].min().line]; + auto ref_line = selections[selection-1].min().line; + const String& line = buffer[ref_line]; auto it = line.begin(); while (it != line.end() and is_horizontal_blank(*it)) ++it; - const String indent{line.begin(), it}; + const StringView indent = line.substr(0_byte, (int)(it-line.begin())); ScopedEdition edition{context}; for (auto& l : lines) { + if (l == ref_line) + continue; + auto& line = buffer[l]; ByteCount i = 0; while (i < line.length() and is_horizontal_blank(line[i]))