From cc88b0f5861254cd9a95e7289f843e68fb7edbc1 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 4 Mar 2017 17:43:44 +0000 Subject: [PATCH] Change word object selector to fail if the cursor is not on a word char --- src/selectors.cc | 5 +---- test/unit/object/around/next-word/cmd | 1 - test/unit/object/around/next-word/in | 1 - test/unit/object/around/next-word/selections | 1 - 4 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 test/unit/object/around/next-word/cmd delete mode 100644 test/unit/object/around/next-word/in delete mode 100644 test/unit/object/around/next-word/selections diff --git a/src/selectors.cc b/src/selectors.cc index 4cdde9f9..a4f8b9d6 100644 --- a/src/selectors.cc +++ b/src/selectors.cc @@ -120,10 +120,7 @@ select_word(const Buffer& buffer, const Selection& selection, int count, ObjectFlags flags) { Utf8Iterator first{buffer.iterator_at(selection.cursor()), buffer}; - if (not is_word(*first) and - ((flags & ObjectFlags::Inner) or - not skip_while(first, buffer.end(), [](Codepoint c) - { return not is_word(c); }))) + if (not is_word(*first)) return {}; Utf8Iterator last = first; diff --git a/test/unit/object/around/next-word/cmd b/test/unit/object/around/next-word/cmd deleted file mode 100644 index b11a4948..00000000 --- a/test/unit/object/around/next-word/cmd +++ /dev/null @@ -1 +0,0 @@ -w diff --git a/test/unit/object/around/next-word/in b/test/unit/object/around/next-word/in deleted file mode 100644 index 3b0e7a0e..00000000 --- a/test/unit/object/around/next-word/in +++ /dev/null @@ -1 +0,0 @@ -foo%( )bar baz diff --git a/test/unit/object/around/next-word/selections b/test/unit/object/around/next-word/selections deleted file mode 100644 index efe82b7c..00000000 --- a/test/unit/object/around/next-word/selections +++ /dev/null @@ -1 +0,0 @@ -bar