diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-02-09 21:09:17 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-02-09 21:09:17 +0000 |
| commit | 56dd5f9540d752b4af4e252aaf0cdfe1ab3c90a0 (patch) | |
| tree | d7df0930919ea081318e3df95e5e3b76a00bfe35 | |
| parent | ec1d5509bb95fcb91a2a05224e8ee5ccb638495d (diff) | |
Fix selecting of insert text in SelectionList::insert
| -rw-r--r-- | src/selection.cc | 7 | ||||
| -rw-r--r-- | test/unit/concat-paste-line/cmd | 1 | ||||
| -rw-r--r-- | test/unit/concat-paste-line/in | 1 | ||||
| -rw-r--r-- | test/unit/concat-paste-line/out | 2 | ||||
| -rw-r--r-- | test/unit/concat-paste-line/state | 1 |
5 files changed, 10 insertions, 2 deletions
diff --git a/src/selection.cc b/src/selection.cc index 91527080..936e8144 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -499,8 +499,11 @@ void SelectionList::insert(ArrayView<String> strings, InsertMode mode, if (select_inserted or mode == InsertMode::Replace) { - sel.min() = change.begin; - sel.max() = m_buffer->char_prev(change.end); + // we want min and max from *before* we do any change + auto& min = sel.min(); + auto& max = sel.max(); + min = change.begin; + max = m_buffer->char_prev(change.end); } else { diff --git a/test/unit/concat-paste-line/cmd b/test/unit/concat-paste-line/cmd new file mode 100644 index 00000000..3ff90ae0 --- /dev/null +++ b/test/unit/concat-paste-line/cmd @@ -0,0 +1 @@ +xy<a-p> diff --git a/test/unit/concat-paste-line/in b/test/unit/concat-paste-line/in new file mode 100644 index 00000000..a999a0c2 --- /dev/null +++ b/test/unit/concat-paste-line/in @@ -0,0 +1 @@ +line diff --git a/test/unit/concat-paste-line/out b/test/unit/concat-paste-line/out new file mode 100644 index 00000000..13e3d3ab --- /dev/null +++ b/test/unit/concat-paste-line/out @@ -0,0 +1,2 @@ +line +line diff --git a/test/unit/concat-paste-line/state b/test/unit/concat-paste-line/state new file mode 100644 index 00000000..5a13c9cf --- /dev/null +++ b/test/unit/concat-paste-line/state @@ -0,0 +1 @@ +2.1+5 |
