summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Functions/Zle/match-words-by-style8
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 417408d81..27ce01dd4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-07-08 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 38796: Functions/Zle/match-words-by-style: fix subword
+ matching on last character of subword.
+
2016-07-05 Oliver Kiddle <opk@zsh.org>
* arno: 38780: Completion/X/Command/_setxkbmap: include
diff --git a/Functions/Zle/match-words-by-style b/Functions/Zle/match-words-by-style
index 54e019d23..6cdec7551 100644
--- a/Functions/Zle/match-words-by-style
+++ b/Functions/Zle/match-words-by-style
@@ -202,7 +202,7 @@ if [[ $wordstyle = *subword* ]]; then
# followed by a lower case letter, or an upper case letter at
# the start of a group of upper case letters. To make
# it easier to be consistent, we just use anything that
- # isn't an upper case characer instead of a lower case
+ # isn't an upper case character instead of a lower case
# character.
# Here the initial "*" will match greedily, so we get the
# last such match, as we want.
@@ -237,6 +237,12 @@ if [[ $wordstyle = *subword* ]]; then
-n $match[2] ]]; then
# Yes, so the last one is new word boundary.
(( epos = ${#match[1]} - 1 ))
+ # Otherwise, are we in the middle of a word?
+ # In other, er, words, we've got something on the left with no
+ # white space following and something that doesn't start a word here.
+ elif [[ -n $word1 && -z $ws1 && -z $ws2 && \
+ $word2 = (#b)([^${~subwordrange}]##)* ]]; then
+ (( epos = ${#match[1]} ))
# Otherwise, do we have upper followed by non-upper not
# at the start? Ignore the initial character, we already
# know it's a word boundary so it can be an upper case character