From 382d5a334c055521893ddd17b2eda1d6d377cb86 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 25 Jan 2012 18:59:11 +0000 Subject: [PATCH] do not use a DynamicBufferIterator in IncrementalInserter::IncrementalInserter --- src/window.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/window.cc b/src/window.cc index 2ab34423..4e1e481f 100644 --- a/src/window.cc +++ b/src/window.cc @@ -424,7 +424,7 @@ IncrementalInserter::IncrementalInserter(Window& window, Mode mode) for (auto& sel : m_window.selections()) { - DynamicBufferIterator pos; + BufferIterator pos; switch (mode) { case Mode::Insert: pos = sel.begin(); break; @@ -434,18 +434,19 @@ IncrementalInserter::IncrementalInserter(Window& window, Mode mode) case Mode::OpenLineBelow: case Mode::AppendAtLineEnd: pos = m_window.m_buffer.iterator_at_line_end(sel.end() - 1) - 1; - if (mode == Mode::OpenLineBelow) - apply(Modification::make_insert(pos, "\n")); break; case Mode::OpenLineAbove: case Mode::InsertAtLineBegin: pos = m_window.m_buffer.iterator_at_line_begin(sel.begin()); if (mode == Mode::OpenLineAbove) - apply(Modification::make_insert(--pos, "\n")); + --pos; break; } sel = Selection(pos, pos, sel.captures()); + + if (mode == Mode::OpenLineBelow or mode == Mode::OpenLineAbove) + apply(Modification::make_insert(pos, "\n")); } }