From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 6586 invoked from network); 22 Dec 2021 23:10:00 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 22 Dec 2021 23:10:00 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1640214600; b=Jw6p28KRKpuHb6oqkC22bktwnZlZier/6pAA6p7HbEpZrscxrmq5FEs+R7bpm0kn/gdzJavg6E w9StQ/iyWMPSsiQkObJfs6IwIOyygnQ5eN5inP55LucmjE0WIn/6/l5kPXMSHncLPAbl3yY1A6 ZdvhC8FMGqERtGFyM1R5/A9n7fZjaHwcHEHdd8WNMjaI/hkRzk+y9e+5CkcO3O2RLkQ0AICJyi CAT1Lcoy8ngiGQP6aluFDTCcp/uXRYRjHXIbCcm6oFunThNdt3SkJ1sU38pVkW+AkDGFUIdUoV 8tXZmU5lcttGUo/DS7tUqQaBNuNTFBrHaM9Cde4MCUiNhQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ot1-f48.google.com) smtp.remote-ip=209.85.210.48; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1640214600; bh=wtIRiH+lFVwP0/8SG+xcKlJf/kUGPvKdswPWVRRVz8A=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:MIME-Version:Content-Type:References:In-Reply-To:Date:To: From:Subject:Message-ID:DKIM-Signature:DKIM-Signature; b=IGdn1Y8SZNKcrUqBAtQIVfew/deRUxG2vSBceddD5w0nBOD5M+0UBs4ZwgqCp/cd3Lm9GpCe6b zI4u1hOUFcXSXjHaaqzIfD5hdSlOSYWV6ksRDobuoFGqbdtn+eZjsuGCxKp/eo+u1v3gsrWE+z Im9zYpPFUdD6nj2hSUBN3ajFNH1OFRBvzdUvSF161siB9mOXGivTfR9pwDW3NABzV6N9ewdl31 G4ToW3Z4UblueW0QXtmpaLQerE1qZCTPm/kpgSdgYylKqFU17gUSWEEazg1qKO5zQaDj0KQRbi xUh24ba8PbATujTJbeT8RaVHxD0nbTSvFiC98yIm0MUk5A==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:MIME-Version:Content-Type:References: In-Reply-To:Date:To:From:Subject:Message-ID:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=wtIRiH+lFVwP0/8SG+xcKlJf/kUGPvKdswPWVRRVz8A=; b=Occzz+M6nFyv5ZFl1y5aT7wTUL gL687iPTromzRrJAX66lVkZzZpt5Kfw5+3EvTDNBl+o5zrirosjGuRqeu1xYkBd2SvZXXtAngTFTA AgbelURVs5jLodE7mKNrkk+xBMrWBqicu4roaipof0NiiMQA5gpaafhQxrpuCScWWU9JHErUw++IH t+aNNuezHd01rSVmegveX35AtGCalEK7heTySK4gQC6YHVHyMb4rpjvpXaEIO/I5XZwSHbK6o8JkI wYvryNOzA1P+DrwZSUOgWhryetzOo6mFtu7Ek3kXPO6AYir1CwDBSykMDz7RVE8BRZ36CvMI/M+Ng nyVVOklw==; Received: from authenticated user by zero.zsh.org with local id 1n0AkB-0000BG-Ew; Wed, 22 Dec 2021 23:09:59 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ot1-f48.google.com) smtp.remote-ip=209.85.210.48; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ot1-f48.google.com ([209.85.210.48]:39493) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1n0AjP-000PSG-0E; Wed, 22 Dec 2021 23:09:11 +0000 Received: by mail-ot1-f48.google.com with SMTP id r10-20020a056830080a00b0055c8fd2cebdso4681407ots.6 for ; Wed, 22 Dec 2021 15:09:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version; bh=wtIRiH+lFVwP0/8SG+xcKlJf/kUGPvKdswPWVRRVz8A=; b=N4S1ATYdt+qJrHU7JMgldp7duq6mYv3cTIwrYghKB/6LHBsgs5XeyBwgI69iSb1yVV 5Hf5lgfRKPayfA8bFC+GPTBPBfEhgbCK0E3gKJRouyP39y1WQ2KJZmMmZoizfPerQNRs dxvOsM1sqGQ/kfGFF8IhzoULxkGyZYdv0RcnAewfvVzpMZAuSsk2htV8jKc5UxS9S12m ZGaNMpfk00mSzWES06qJ+BSD9tM0AuDZimBvnFk5LvA98hDDSeRcftx5GoKPYDgYBY7D hZqtKK8nS2chdSqhGuekd/+ydkbmradMgllr18PduOPzivKXZ95LHQlK9yjkVKIJIljz IqHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version; bh=wtIRiH+lFVwP0/8SG+xcKlJf/kUGPvKdswPWVRRVz8A=; b=DZqboqKq9cMSDK78/M8WesAEXid5eN3x7bc1sureEl3oanH+S4yJnEpcQ0wzz3Mgkm QmfZ/kA0IfYKEH2U+1RwtpxFPRz0N+5CuNrguyXdhyHCHSuGCaMOBhlTN5Fcmy9JimkB vhXVohdub05qQJqq6SIsHmawAPwttG8hxO4c3rFspgouqARvDpFq1twOfCMWA7WglWZp EQh42+D1fxT9JeTdZH9ECVEDNAy4+kUn52Hd174w1Z4WPBSCr+QdNTpjg77WaB5/0rdt +S1IB0rBk66LRio2+2hkuDsJZz1cDYtWfzcUQmNCoWsmRVhlQG1aSA+1LzlSLxibgmMd /CdQ== X-Gm-Message-State: AOAM531Eo9WHT7Yvu2XAtHS3iG3WLUO/EjrJXPPPNOv8/aLDMjCD+FIL GMRikq/o3BQo3yNPVQGUI4T8xCCdrT8= X-Google-Smtp-Source: ABdhPJzpjL1lqpNdmh4fKqT6P+LYAK3kkNkW6/DReRYqjZ7+EzUwn5Qe0x/1rWGFmfax2hu9DkYi2g== X-Received: by 2002:a9d:3602:: with SMTP id w2mr1085713otb.311.1640214549363; Wed, 22 Dec 2021 15:09:09 -0800 (PST) Received: from ?IPv6:2600:1700:3f7b:20f:70ac:74ff:fe39:2204? ([2600:1700:3f7b:20f:70ac:74ff:fe39:2204]) by smtp.gmail.com with ESMTPSA id a6sm635230oil.6.2021.12.22.15.09.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 15:09:08 -0800 (PST) Message-ID: Subject: Re: Strange behavior when calling select-a-shell-word multiple times from the same user-defined widget From: Daniel Parks To: zsh-users@zsh.org Date: Wed, 22 Dec 2021 17:09:06 -0600 In-Reply-To: <6e3644fd-07ad-4251-9310-b6899c41a233@www.fastmail.com> References: <2495135b4cf73e7add73e3fcd5fd6165a76b3cfa.camel@gmail.com> <6e3644fd-07ad-4251-9310-b6899c41a233@www.fastmail.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-k5+0XuFqxo5oNdBXzkxS" User-Agent: Evolution 3.42.2 MIME-Version: 1.0 X-Seq: 27437 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: --=-k5+0XuFqxo5oNdBXzkxS Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2021-12-22 at 22:08 +0000, Daniel Shahaf wrote: > Adding =C2=AB-N=C2=BB to both select-a-shell-word calls does the trick. Thanks, that fixed it! I do still think it's pretty strange, though, because select-a-shell-word does not normally seem to respond to the numeric argument in a command like `v3aa` (still only selects one word). > While here, you can simplify the function a bit.=C2=A0 For one, you could > use > a =C2=ABrepeat=C2=BB loop =E2=80=94 its repeat count is a math expression= , so you can > actually do =C2=ABrepeat "NUMERIC - 1"; do =E2=80=A6; done=C2=BB Nice, thanks for pointing that out. > =C2=A0=E2=80=94 but I'm not sure why you > select-a-shell-word more than once.=C2=A0 Why not just this: >=20 > select-n-shell-word() { > =C2=A0 CURSOR=3D0 > =C2=A0 repeat "${NUMERIC:-1} - 1" zle vi-forward-word > =C2=A0 zle visual-mode > =C2=A0 zle select-a-shell-word -N > } I want to select the nth argument on the command line, taking into account spaces, so using vi-forward-word is not a good choice. For example, on the command `echo "these are all one" third` I want 3:select-n-shell-word to select echo "these are all one"[ third] not echo[ "these are all one"] third > =C2=ABCURSOR=3D0=C2=BB is not equivalent to =C2=ABzle vi-beginning-of-lin= e=C2=BB when > there's > a literal newline in $BUFFER.=C2=A0 Pick what you prefer. Oops, thank you for that as well. I appreciate all the help! It's working perfectly now. --=-k5+0XuFqxo5oNdBXzkxS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEihRGVK2Zyp6YT0FW7HTq7BlqZI4FAmHDsBIACgkQ7HTq7Blq ZI62AxAAqKSsaB3vofMsCN7UKWyodq2b61iIDbTybBKNUs279E8Kuia43QnzDHO9 gEUsfzxr2GV0IkWKFZSzHACGkH7Ve79I3Z/Flh1i4EHP0qXJxjjueC04eLyzCrNr lctSRuos6PZgw5bdwSiSvjkKPocrKsbSx6Zvxuxowk5dGNB2KTLQIp9HV8tndUoa QCk67/A7TlaVQvFba+JKAuFhQE6HeP+UGXbzAaIBo5K+SlI0Hp9z+H1DjhsZjZ6L VT4jLCAd78s/Nsn/HuFWkWP+hIMSC9Mq1Q9du+k5Kv2s/W+aqDWnCG66DHOru953 hsKYag2f55gbhq2Glm/c2ERE7G3Qr3WJcFvsjaVn1T+HX3GwpBQ/YPuJfS7rEkAN NwJIsBA11PwA5UPqp+vp7nf8eF1O62cjlzexpQbDBKWuPB4E8vp+JiKBjVC1ExoQ dMrIj4VmrO8ZaLjp0NPWnkbOgxF8VyV+Pk24gEWP5fnkcSeeze7ziPBxXLBZyFng jiMLxLVvPFRydcujIL7rPqzzDmIxO9R7DACjNMSDisuxrrHPi5i3i58GaZ8Bb4oG 0GSVLEb8m1t506Vy4rD+0ltjs4GLEMxLQJGBugYoWvgyeuoqQwYQTxjl2lBb8nXZ SLyfp4pVu1ZKD4zuCsf3EnmGQQqJoew/Iu/WICqfMUIoF+QoOLk= =8eCq -----END PGP SIGNATURE----- --=-k5+0XuFqxo5oNdBXzkxS--