join: preserve multiple selections

This commit is contained in:
Maxime Coste 2012-12-18 19:00:55 +01:00
parent 43ad920bd8
commit cf7e6bdd07

View File

@ -264,12 +264,12 @@ void do_split_regex(Context& context)
void do_join(Context& context) void do_join(Context& context)
{ {
Editor& editor = context.editor(); Editor& editor = context.editor();
DynamicSelectionList sels{editor.buffer(), editor.selections()};
editor.select(select_whole_lines); editor.select(select_whole_lines);
editor.select(select_to_eol, SelectMode::Extend); editor.select(select_to_eol, SelectMode::Extend);
editor.multi_select(std::bind(select_all_matches, _1, "\n\\h*")); editor.multi_select(std::bind(select_all_matches, _1, "\n\\h*"));
editor.insert(" ", InsertMode::Replace); editor.insert(" ", InsertMode::Replace);
editor.clear_selections(); editor.select(sels);
editor.move_selections(-1_char);
} }
void do_indent(Context& context) void do_indent(Context& context)