Fix indent/deindent when only empty lines are selected

This commit is contained in:
Maxime Coste 2014-03-29 09:02:09 +00:00
parent da9d099f3b
commit 0fe9683c0f

View File

@ -787,9 +787,12 @@ void indent(Context& context, int)
sels.emplace_back(line, line); sels.emplace_back(line, line);
} }
} }
if (not sels.empty())
{
ScopedEdition edition(context); ScopedEdition edition(context);
insert<InsertMode::Insert>(buffer, sels, indent); insert<InsertMode::Insert>(buffer, sels, indent);
} }
}
template<bool deindent_incomplete = true> template<bool deindent_incomplete = true>
void deindent(Context& context, int) void deindent(Context& context, int)
@ -828,9 +831,12 @@ void deindent(Context& context, int)
} }
} }
} }
if (not sels.empty())
{
ScopedEdition edition(context); ScopedEdition edition(context);
erase(context.buffer(), sels); erase(context.buffer(), sels);
} }
}
template<ObjectFlags flags, SelectMode mode = SelectMode::Replace> template<ObjectFlags flags, SelectMode mode = SelectMode::Replace>
void select_object(Context& context, int param) void select_object(Context& context, int param)