Do not touch the reference line in copy_indent

This commit is contained in:
Maxime Coste 2014-06-09 19:26:53 +01:00
parent cf2609de1c
commit 4834504508

View File

@ -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]))