From 88def85d77b935af3c869e5ede41ca125a114daf Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 22 Nov 2014 19:58:34 +0000 Subject: [PATCH] Do not merge overlapping selections in InputMode::Replace Fixes #237 --- src/input_handler.cc | 2 +- test/unit/insert-replace/cmd | 1 + test/unit/insert-replace/in | 1 + test/unit/insert-replace/out | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 test/unit/insert-replace/cmd create mode 100644 test/unit/insert-replace/in create mode 100644 test/unit/insert-replace/out diff --git a/src/input_handler.cc b/src/input_handler.cc index b543a268..71a5d63f 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -979,7 +979,7 @@ private: kak_assert(false); // invalid for interactive insert break; } - if (mode != InsertMode::Append) + if (mode != InsertMode::Append and mode != InsertMode::Replace) selections.sort_and_merge_overlapping(); selections.check_invariant(); buffer.check_invariant(); diff --git a/test/unit/insert-replace/cmd b/test/unit/insert-replace/cmd new file mode 100644 index 00000000..daa37b38 --- /dev/null +++ b/test/unit/insert-replace/cmd @@ -0,0 +1 @@ +cthis was " diff --git a/test/unit/insert-replace/in b/test/unit/insert-replace/in new file mode 100644 index 00000000..546219dd --- /dev/null +++ b/test/unit/insert-replace/in @@ -0,0 +1 @@ +%(word1)%(word2)%(word3)%(word4) diff --git a/test/unit/insert-replace/out b/test/unit/insert-replace/out new file mode 100644 index 00000000..fae360dd --- /dev/null +++ b/test/unit/insert-replace/out @@ -0,0 +1 @@ +this was word1 this was word2 this was word3 this was word4