From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: bug with camel case and delete-whole-word-match function
Date: Tue, 26 Jul 2016 14:52:24 +0100 [thread overview]
Message-ID: <20160726145224.7910b718@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <5374.1469315162@hydra.kiddle.eu>
On Sun, 24 Jul 2016 01:06:02 +0200
Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
> One is that if the cursor is in the middle of a block of whitespace
> at the end of the line, the 4th element (whitespace after cursor)
> is empty while element 7 contains the whitespace.
> A similar issue occurs at the start of the line - element 1 contains
> whitespace while element 3 doesn't.
I'm not sure what you're testing. I've put a test function below and
ran it with
mwbs-test -w normal-subword $'one two ThreeFour ' $' \nFiveSix seven'
and I get
start: 'one two Three'
wd-before-c: 'Four'
ws-before-c: ' '
ws-after-c: '
'
wd-after-c: 'Five'
ws-after-w: ''
end: 'Six seven'
which is what I expect. Similarly at the start of the next line. Do
you get something different, or isn't it testing for the problem at all?
> The other issue is that with the shell word style, it'll put whitespace
> at the end of element 5 instead of in element 6.
Aagain, I get:
mwbs-test -w shell $'one two ThreeFour \n ' $' FiveSix seven'
start: 'one two '
wd-before-c: 'ThreeFour'
ws-before-c: '
'
ws-after-c: ' '
wd-after-c: 'FiveSix'
ws-after-w: ' '
end: 'seven'
pws
# mwbs-test
autoload -Uz match-words-by-style
local wordstyle=normal-subword
local opt
while getopts "w:" opt; do
case $opt in
(w)
wordstyle=$OPTARG
;;
(*)
return 1
;;
esac
done
shift $(( OPTIND - 1 ))
if (( $# != 2 )); then
print "Usage: mwbs-test LBUFFER RBUFFER" >&2
return 1
fi
local -a matched_words
local LBUFFER=$1 RBUFFER=$2
match-words-by-style -w $wordstyle || return
print -r "\
start: '$matched_words[1]'
wd-before-c: '$matched_words[2]'
ws-before-c: '$matched_words[3]'
ws-after-c: '$matched_words[4]'
wd-after-c: '$matched_words[5]'
ws-after-w: '$matched_words[6]'
end: '$matched_words[7]'
"
next prev parent reply other threads:[~2016-07-26 13:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <588168129.3340906.1467709726474.JavaMail.yahoo.ref@mail.yahoo.com>
2016-07-05 9:08 ` Oliver Kiddle
2016-07-05 10:19 ` Peter Stephenson
2016-07-05 16:12 ` Bart Schaefer
2016-07-05 16:28 ` Peter Stephenson
2016-07-23 23:06 ` Oliver Kiddle
2016-07-24 19:44 ` Peter Stephenson
2016-07-26 13:52 ` Peter Stephenson [this message]
2016-07-26 18:22 ` Oliver Kiddle
2016-07-27 8:54 ` Peter Stephenson
2016-07-27 23:05 ` Oliver Kiddle
2016-07-26 15:51 ` Peter Stephenson
2016-07-26 16:00 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160726145224.7910b718@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).