From f04a7a0ed309f346e7f9a1ad0bc601ee5c24c75d Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Tue, 26 Jul 2016 10:39:18 +0300 Subject: [PATCH 1/2] Allow selection primitives to use arbitrary punctuation signs --- src/normal.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/normal.cc b/src/normal.cc index 50f7ca61..288b70e5 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -996,6 +996,14 @@ void select_object(Context& context, NormalParams params) sur.opening, sur.closing, level, flags)); } + + if (is_punctuation(*cp)) + { + StringView strview_codepoint{String(*cp)}; + return select(context, std::bind(select_surrounding, _1, _2, + strview_codepoint, strview_codepoint, + level, flags)); + } }, get_title(), "b,(,): parenthesis block\n" "B,{,}: braces block \n" From ad288be1a057620aacc95e89a0f8c932f82f1221 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Tue, 26 Jul 2016 10:42:33 +0300 Subject: [PATCH 2/2] Add unit tests for an arbitrary slash-based selection --- test/unit/around/slash/cmd | 1 + test/unit/around/slash/in | 1 + test/unit/around/slash/selections | 1 + test/unit/inner/slash/cmd | 1 + test/unit/inner/slash/in | 1 + test/unit/inner/slash/selections | 1 + 6 files changed, 6 insertions(+) create mode 100644 test/unit/around/slash/cmd create mode 100644 test/unit/around/slash/in create mode 100644 test/unit/around/slash/selections create mode 100644 test/unit/inner/slash/cmd create mode 100644 test/unit/inner/slash/in create mode 100644 test/unit/inner/slash/selections diff --git a/test/unit/around/slash/cmd b/test/unit/around/slash/cmd new file mode 100644 index 00000000..3b264409 --- /dev/null +++ b/test/unit/around/slash/cmd @@ -0,0 +1 @@ +/ diff --git a/test/unit/around/slash/in b/test/unit/around/slash/in new file mode 100644 index 00000000..d6b8a544 --- /dev/null +++ b/test/unit/around/slash/in @@ -0,0 +1 @@ +foo(/%(b)ar/) diff --git a/test/unit/around/slash/selections b/test/unit/around/slash/selections new file mode 100644 index 00000000..a5a08411 --- /dev/null +++ b/test/unit/around/slash/selections @@ -0,0 +1 @@ +/bar/ diff --git a/test/unit/inner/slash/cmd b/test/unit/inner/slash/cmd new file mode 100644 index 00000000..753eb6b7 --- /dev/null +++ b/test/unit/inner/slash/cmd @@ -0,0 +1 @@ +/ diff --git a/test/unit/inner/slash/in b/test/unit/inner/slash/in new file mode 100644 index 00000000..d6b8a544 --- /dev/null +++ b/test/unit/inner/slash/in @@ -0,0 +1 @@ +foo(/%(b)ar/) diff --git a/test/unit/inner/slash/selections b/test/unit/inner/slash/selections new file mode 100644 index 00000000..5716ca59 --- /dev/null +++ b/test/unit/inner/slash/selections @@ -0,0 +1 @@ +bar