diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-12-19 13:45:38 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-12-19 13:58:33 +0000 |
| commit | 116ea7364ab70703cea4a6fc2ce34c42b99fc13e (patch) | |
| tree | e06990a9bb1a09f34d66d8ffbad00a859de1b8cc /src | |
| parent | c454cf137971fda09c0c0a3af6acea952efc2f3a (diff) | |
Restore some special behaviours, I missed them in interactive mode.
Diffstat (limited to 'src')
| -rw-r--r-- | src/input_handler.cc | 1 | ||||
| -rw-r--r-- | src/selection.cc | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc index 4cc6d5ee..975e457b 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -1016,6 +1016,7 @@ private: if (m_insert_mode == InsertMode::Append and sel.cursor().column > 0) sel.cursor() = context().buffer().char_prev(sel.cursor()); } + selections.avoid_eol(); if (m_disable_hooks) context().user_hooks_support().enable(); diff --git a/src/selection.cc b/src/selection.cc index a9623a73..d5f72eb3 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -443,7 +443,11 @@ BufferIterator prepare_insert(Buffer& buffer, const Selection& sel, InsertMode m case InsertMode::Replace: return erase(buffer, sel); 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: return buffer.iterator_at(sel.min().line); case InsertMode::AppendAtLineEnd: |
