From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14567 invoked by alias); 12 Jan 2016 06:26:16 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 37567 Received: (qmail 14197 invoked from network); 12 Jan 2016 06:26:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=tEQSmBR/iIrPR2HiqTPykTsi7smB06HFYgRDdn9e0Dg=; b=1BKkIcpB1TKW2oX85Q1CcWc7L67fCVIv+Hj1a6bmjMrh1dRoNz2qQrfMkE9/Tj9fU+ jWP38nXUEU6Z0xC1kLmnmKQ0sfeMI1VplKKl5zZ9j7PNbzCvNs2JowW96r0JjRY8a+Pu pLjZbU0L/h1C+bw6KFag3LLnx7aCl3nhDg6CDB93s1iNNOcNxhrdiw+idTt71KJlBZ+u WFQLGfTr15c6iU8yHLZs540Mcx61fLrWir1Icvons15Yq/OS6oUx2+ixmhKVf8mmMIFW /okR11h02sr9QHbMNbId6XEf56kD4bxt7IwkvDv+g0BXYOvo1v38iSQ6vSzLYRuBsBBA Ui4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=tEQSmBR/iIrPR2HiqTPykTsi7smB06HFYgRDdn9e0Dg=; b=AIkTOS7qI1cSYA7fgge2qmehWmxBLf2acdLTP0UQMZeioKq6YpjMkK/Le10csx9Byw a2rcDLj5HvDTHXYXMzJZJ0e2N9ua2+7RwPBLAf+/J8kAwvJs8kfjHgkA4VxLgo5xBGG2 c2CUA+GmCo64jXTYCsvCgRR5Ryf+9q2KHyZ+l+cQ49Ev7uMfE5onG697OU6TfeuEdtjo KQmw2gsUGRMTjqk0smHYlxnl2rWYaUQ+t9eePHbaNJuF4l1v3cATRcEZaIUnMWtsp/Mi rdk+SiolTirJ77tDmFYybXaYNwjIuO0buAc/PGMsgi1NJcM5DM1m1Wh1v9Rvx46KIecX xamg== X-Gm-Message-State: ALoCoQkq92F0C/efm1lkWZssij4DXlVE9b7ZLuBHUWGIV4SshPftYojWBLkEMpWSn4HJxwTqcCEvUxkYlMHWFVNfv37HDmFB2Q== X-Received: by 10.98.0.150 with SMTP id 144mr5815574pfa.139.1452579970819; Mon, 11 Jan 2016 22:26:10 -0800 (PST) From: Bart Schaefer Message-Id: <160111222623.ZM6334@torch.brasslantern.com> Date: Mon, 11 Jan 2016 22:26:23 -0800 In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Re: transpose-words-match (Re: New widget "transpose-segments")" (Jan 11, 2:13pm) References: <160109092258.ZM3394@torch.brasslantern.com> <160109094833.ZM3453@torch.brasslantern.com> <160109101801.ZM3561@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh hackers list Subject: Re: transpose-words-match (Re: New widget "transpose-segments") MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jan 11, 2:13pm, Sebastian Gniazdowski wrote: } } Bart there already is "copy-prev-shell-word". It's good to not be } bound to global select-word-style setting. Just for the record, although there is a global select-word-style setting for convenience, you can also select different word styles for different contexts. There are a few examples in the manual. The word styles can also handle things like swapping CapsLikeThis to CapsThisLike where the only "word break" is a case difference. Further, copy-prev-shell-word is a built-in widget; and it appears to have a bug when the previous shell word is a single character with no whitespace between it and the cursor. (The transpose-words builtin has a similar difficulty with one-character words, I think.) } That said I tested your bksw and it doesn't fully work for following [...] } There is a space after "". When cursor is positioned after this space, } invoking bksw joins lines "" and a\ b instead of deleting "". select-in-shell-word is intended to emulate some vim functionality that excludes quotes (only selects what's inside them) so empty quotes might be expected to confuse it. I have to thank you for this example, because it allowed me to realize why newlines confuse match-words-by-style. It needs to be using the (Z:n:) flag rather than the (z) flag; the latter converts newlines into semicolons, but this wants newlines as whitespace. I see Daniel has also done something for interactive_comments, I'm not sure whether that's needed in match-words-by-style. [By the way, Daniel, (zZ:c:) is redundant, you only need (Z:c:).] diff --git a/Functions/Zle/match-words-by-style b/Functions/Zle/match-words-by-style index b387828..7ba6157 100644 --- a/Functions/Zle/match-words-by-style +++ b/Functions/Zle/match-words-by-style @@ -111,20 +111,20 @@ done case $wordstyle in (*shell*) local bufwords # This splits the line into words as the shell understands them. - bufwords=(${(z)LBUFFER}) + bufwords=(${(Z:n:)LBUFFER}) nwords=${#bufwords} wordpat1="${(q)bufwords[-1]}" # Take substring of RBUFFER to skip over $skip characters # from the cursor position. - bufwords=(${(z)RBUFFER[1+$skip,-1]}) + bufwords=(${(Z:n:)RBUFFER[1+$skip,-1]}) wordpat2="${(q)bufwords[1]}" spacepat='[[:space:]]#' # Assume the words are at the top level, i.e. if we are inside # 'something with spaces' then we need to ignore the embedded # spaces and consider the whole word. - bufwords=(${(z)BUFFER}) + bufwords=(${(Z:n:)BUFFER}) if (( ${#bufwords[$nwords]} > ${#wordpat1} )); then # Yes, we're in the middle of a shell word. # Find out what's in front.