summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-06-09 19:26:53 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-06-09 19:27:57 +0100
commit4834504508bdbde70c536bad28260cbaabc6ceec (patch)
treed2ffcfd1d8b41fb4b1b9659aa01337b9e57a85e5 /src
parentcf2609de1ce80e069045bc4f567c79d22345ca39 (diff)
Do not touch the reference line in copy_indent
Diffstat (limited to 'src')
-rw-r--r--src/normal.cc8
1 files 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]))