Restore some special behaviours, I missed them in interactive mode.

This commit is contained in:
Maxime Coste 2014-12-19 13:45:38 +00:00
parent c454cf1379
commit 116ea7364a
2 changed files with 6 additions and 1 deletions

View File

@ -1016,6 +1016,7 @@ private:
if (m_insert_mode == InsertMode::Append and sel.cursor().column > 0) if (m_insert_mode == InsertMode::Append and sel.cursor().column > 0)
sel.cursor() = context().buffer().char_prev(sel.cursor()); sel.cursor() = context().buffer().char_prev(sel.cursor());
} }
selections.avoid_eol();
if (m_disable_hooks) if (m_disable_hooks)
context().user_hooks_support().enable(); context().user_hooks_support().enable();

View File

@ -443,7 +443,11 @@ BufferIterator prepare_insert(Buffer& buffer, const Selection& sel, InsertMode m
case InsertMode::Replace: case InsertMode::Replace:
return erase(buffer, sel); return erase(buffer, sel);
case InsertMode::Append: case InsertMode::Append:
return utf8::next(buffer.iterator_at(sel.max()), buffer.end()); {
// special case for end of lines, append to current line instead
auto pos = buffer.iterator_at(sel.max());
return *pos == '\n' ? pos : utf8::next(pos, buffer.end());
}
case InsertMode::InsertAtLineBegin: case InsertMode::InsertAtLineBegin:
return buffer.iterator_at(sel.min().line); return buffer.iterator_at(sel.min().line);
case InsertMode::AppendAtLineEnd: case InsertMode::AppendAtLineEnd: