Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Qmail-Scanner-Diagnostics: from mailout2.w1.samsung.com by f.primenet.com.au (envelope-from <p.stephenson@samsung.com>, uid 7791) with qmail-scanner-2.11 
 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1.  
 Clear:RC:0(210.118.77.12):SA:0(-1.3/5.0):. 
 Processed in 0.159546 secs); 26 Jul 2016 13:52:37 -0000
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.3 required=5.0 tests=RP_MATCHES_RCVD
	autolearn=unavailable autolearn_force=no version=3.4.1
X-Envelope-From: p.stephenson@samsung.com
X-Qmail-Scanner-Mime-Attachments: |
X-Qmail-Scanner-Zip-Files: |
Received-SPF: none (ns1.primenet.com.au: domain at samsung.com does not designate permitted sender hosts)
X-AuditID: cbfec7f5-f792a6d000001302-1d-57976b1b63ff
Date: Tue, 26 Jul 2016 14:52:24 +0100
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: bug with camel case and delete-whole-word-match function
Message-id: <20160726145224.7910b718@pwslap01u.europe.root.pri>
In-reply-to: <5374.1469315162@hydra.kiddle.eu>
References: <588168129.3340906.1467709726474.JavaMail.yahoo.ref@mail.yahoo.com>
 <588168129.3340906.1467709726474.JavaMail.yahoo@mail.yahoo.com>
 <20160705111900.7e1599f0@pwslap01u.europe.root.pri>
 <5374.1469315162@hydra.kiddle.eu>
Organization: Samsung Cambridge Solution Centre
X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu)
MIME-version: 1.0
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7bit
X-Brightmail-Tracker:
 H4sIAAAAAAAAA+NgFjrPLMWRmVeSWpSXmKPExsVy+t/xK7rS2dPDDWZe5rA42PyQyYHRY9XB
	D0wBjFFcNimpOZllqUX6dglcGZ+aXjMW9PNXPNog3sC4nbuLkZNDQsBEYte8zSwQtpjEhXvr
	2UBsIYGljBKPL1t0MXIB2TOYJCZ2HGaBcM4xSlxtWMQO4ZxllDh/qo0dpIVFQFXixokuZhCb
	TcBQYuqm2YwgtoiAuMTZtefBVggLuEp0fj3KCmLzCthLvNxyCGgdBwengJ7Ep//OEDNfM0q0
	tV8H6+UX0Je4+vcTE8R59hIzr5xhhOgVlPgx+R7YTGYBLYnN25pYIWx5ic1r3jJDvKAucePu
	bvYJjMKzkLTMQtIyC0nLAkbmVYyiqaXJBcVJ6blGesWJucWleel6yfm5mxghwfx1B+PSY1aH
	GAU4GJV4eCe4TgsXYk0sK67MPcQowcGsJML7PW16uBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHe
	mbvehwgJpCeWpGanphakFsFkmTg4pRoYWTJO6xzaX6k4+W+8z6eVLw1z09rcakTX/Zr99PLZ
	7Q0a85p8tvq9TZlzfdUr8bpYZ92PTgJCOtrWV5hKuq5/99XOmj23NFmrzZ2tU0l43uT5BRc8
	Hv86bL2CcWL3+iivWt/ge9d1fOsrNNg+Nl9wfttx750FU/YMj+MrhH691Fr8PboktyJOiaU4
	I9FQi7moOBEAZcw/iWICAAA=
X-Seq: zsh-workers 38950

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]'
"

