From 25a1a9c1599cd20de4a79affe642ebfde9c705c7 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 7 Aug 2012 23:25:54 +0200 Subject: [PATCH] Fix do_pipe --- src/main.cc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main.cc b/src/main.cc index 1adbf3e0..68e32262 100644 --- a/src/main.cc +++ b/src/main.cc @@ -184,15 +184,12 @@ void do_pipe(Context& context) { auto cmdline = prompt("|", context, complete_nothing); - context.buffer().begin_undo_group(); + Editor& editor = context.editor(); + std::vector strings; for (auto& sel : const_cast(context.editor()).selections()) - { - String new_content = ShellManager::instance().pipe(String(sel.begin(), sel.end()), - cmdline, context, {}); - context.buffer().modify(Modification::make_erase(sel.begin(), sel.end())); - context.buffer().modify(Modification::make_insert(sel.begin(), new_content)); - } - context.buffer().end_undo_group(); + strings.push_back(ShellManager::instance().pipe(String(sel.begin(), sel.end()), + cmdline, context, {})); + editor.replace(strings); } catch (prompt_aborted&) {} }