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-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,FREEMAIL_FROM,
	T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :cc:content-type;
        bh=OY268BJrCh6BRAZ4Xrz9+xTr6IeCm8pQE1AnuvznTgg=;
        b=0zfemKpdRBFv37ECyl7JTb2+/azQCvFRD5Fu4vAjppDP2iIaN4Z6lUOQzm9SAmnkc6
         YQ6m6sYARobG8b6E9N2RD24xAceQ5noM13+fmwkP0DMkGzNTtfWVUo44MBdb7hn4AB/G
         Eku+j/zZVs25Ob9L+7kS4894VJRfRDn1VVj/XKopwmm0M+QH+FYUvbE8+VyLCNnFGGnD
         BZdOXVm3AdRRBdrNnpJZznW6ukGvhbaJR0d75KNRRa+GRE5WeOAyDO0xlDcPdxTRAf1v
         AjKTWsHtNXz0uW0QDy7QrwTkNFBc/GcoSQAf8cxAQgj8XaQfELOP+HEDMm1MEin6DGrO
         1Gvg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:cc:content-type;
        bh=OY268BJrCh6BRAZ4Xrz9+xTr6IeCm8pQE1AnuvznTgg=;
        b=lkUQAirQRFl4UDYE/Gq88imRpiz+drm4XAJxBTCOBfkN8rIMg0i4/G8+0lVaGYQJ8m
         nMdMRBWEvsN6qk81SsSz0dDbaL3oSuVbSBd+J6c12T9HCxRnk50P2qTsDDVRc1i5vq+h
         wK5W0w+1ZSPVnSIUqNu6LsJQgqR2gLdZxLiFbczKlSkwfFKfjziGck9/MSB4RHObXSdV
         vvslcq3xeEEtAnd3VJ+Ib00p31Ykex/yr/pRwaxvhfUWXUkEd2VfsB+Fl1JSUQG7ZAdv
         uE3Kv+OalstYbQ3aIr+uoFLlclMWmt9KCr1c4b+rLckyYke/YtV8s+vaKw3yhAM1GvQj
         LMwg==
X-Gm-Message-State: ALoCoQk3zI2DL1kPbmBQbMybjrUDvKyzOsT6v+I+0ugCi7pNj5bb+yGUUjvKV9JWT7R3q7K7LP1XK63McXVVDfjCa65A3Fy4DA==
X-Received: by 10.25.23.86 with SMTP id n83mr29859492lfi.66.1452703275204;
 Wed, 13 Jan 2016 08:41:15 -0800 (PST)
MIME-Version: 1.0
In-Reply-To: <160112180141.ZM9984@torch.brasslantern.com>
References: <CAKc7PVCnEX1rEhNqhtx7spyUVKCWukz4Tzkqr27-OV9+4hVciQ@mail.gmail.com>
 <CAKc7PVDVR=B8SWX+gSiNvtODWZ-25LtDz7jXVDH8BtrcxMnjXQ@mail.gmail.com>
 <160111161501.ZM5305@torch.brasslantern.com> <CAKc7PVBCEM=46YmgmhPR==Rq+pSfY+hgr8bcOMLV=zLFm6THBg@mail.gmail.com>
 <160112113928.ZM9065@torch.brasslantern.com> <20160113010147.GA4699@tarsus.local2>
 <160112180141.ZM9984@torch.brasslantern.com>
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Date: Wed, 13 Jan 2016 17:40:55 +0100
Message-ID: <CAKc7PVBz1nNueRmEfyz3157kvJjEgHW3wmSXraKM+-9P-i5Atw@mail.gmail.com>
Subject: Re: _history-complete-older problems with $(
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Content-Type: multipart/mixed; boundary=001a114024a0aedd16052939d6cb
X-Seq: zsh-workers 37606

--001a114024a0aedd16052939d6cb
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 13 January 2016 at 03:01, Bart Schaefer <schaefer@brasslantern.com> wrot=
e:
> True.  Anyone who wants to fix these issues and post an update is more
> than welcome.  I already spent way more time on it than I intended.

Thanks for the explanations and pointing the manual, this allowed me
to move onward with the code. I didn't use $LBUFFER, but say manually
detected active shell word, and point of break to left and right part
in that word. This will allow to nicely handle COMPLETE_IN_WORD. I
must say it's quite exhausting to handle which word is active. Setting
cursor to "|" in terminal application clarifies few things. Block
cursor highlights a letter, but $CURSOR points before it, where "|"
cursor would stand. Zsh doesn't make following word active, i.e. "ls
|/Users/user_na" with the cursor where "|" is will not complete the
"user_name". I have chosen different approach, in such case I treat
what's after "|" as right part of current shell word. The same I do
for zew-transpose-shell-words (former transpose-segments), block
cursor on first letter of word makes the word active, selected for
transposition.

I do other tricks in the code, e.g. trim left "$((   " out of spaces,
because in case of syntax error (Z+n+) will put spaces in returned
shell word. All this is quite hackish I think. But something could
clarify out of this, and most of all robust Alt-/ is on the horizon.

I have one problem. First compadd returns $found array
populated with matches:

A CURRENT: 3, words: >git,add,wid<
B CURRENT: 3, words: >git,add,wid<
C CURRENT: 3, CURSR: 11, lft: |wid|, rght: ||, words: >git,add,wid<
PREFIX: |wid|, SUFFIX: ||
Calling _history
widen_for_history widen_for_history widen_for_history
widen_for_history widen_for_history widen_for_history
widen_for_history widen_for_history

But nothing is displayed below the prompt, "en" replaces "wid" at
prompt and that's all, while $(<TAB> does:

A CURRENT: 1, words: ><
B CURRENT: 1, words: >$( <
C CURRENT: 1, CURSR: 2, lft: |$(|, rght: ||, words: >$(<
PREFIX: |$(|, SUFFIX: ||
Calling _history
$(( 0 + 1 )) $(( 0 + 1 )) $(( =E8=A9=A6=E5=8F=A5=E7=9B=B8=E7=95=B6=E9=95=B7=
 ""  $(( 0 + 1 )) $( ( echo b ))
$(( echo b ) ) $(( echo a ) ) $(( 0 + 1 )) $(( 0 + 1 )) $(( i + 1 ))
$(( i + 1 )) $(( i + 1 )) $(( i+1 )) $(( i+1 )) $(( i+1 )) $(( i+1 ))
$(( i+1 ))

And below the prompt it's shown:
 ( echo b ))      ( 0 + 1 ))        ( echo a ) )      ( echo b ) )
 ( i + 1 ))        ( i+1 ))          ( =E8=A9=A6=E5=8F=A5=E7=9B=B8=E7=95=B6=
=E9=95=B7 ""

The same problem is with "ls" about which I wrote to you earlier. So
it seems that the second compadd isn't fully working.

The code is here (and also attached):

https://raw.githubusercontent.com/psprint/zsh-editing-workbench/657d6a591be=
a5d26fbed88176ac7de80e8d73927/widen_for_history

Best regards,
Sebastian Gniazdowski

--001a114024a0aedd16052939d6cb
Content-Type: application/octet-stream; name=widen_for_history
Content-Disposition: attachment; filename=widen_for_history
Content-Transfer-Encoding: base64
X-Attachment-Id: f_ijd1yl6o0

ZWNobyAtZSAiXG5BIENVUlJFTlQ6ICRDVVJSRU5ULCB3b3JkczogPiR7KGo6LDopd29yZHN9PCIg
Pj4gL3RtcC93Zmhpc3RvcnkKCndvcmRzPSIkeyhaK24rKUJVRkZFUn0iCmludGVnZXIgbndvcmRz
PSIkeyN3b3Jkc30iCmxvY2FsIGJ1Zj0iJEJVRkZFUiIKCmVjaG8gLWUgIkIgQ1VSUkVOVDogJENV
UlJFTlQsIHdvcmRzOiA+JHsoajosOil3b3Jkc308IiA+PiAvdG1wL3dmaGlzdG9yeQoKIyBSZW1v
dmUgd29yZHMgb25lIGJ5IG9uZSwgY291bnRpbmcgY2hhcmFjdGVycywKIyBjb21wdXRpbmcgYmVn
aW5uaW5nIG9mIGVhY2ggd29yZCwgdG8gZmluZAojIHBsYWNlIHRvIGJyZWFrIHRoZSB3b3JkIGlu
dG8gMiBoYWx2ZXMgKGZvcgojIGNvbXBsZXRlX2luX3dvcmQgb3B0aW9uKQojIElmIHdvdWxkIHVz
ZSAkTEJVRkZFUiwgdGhlbiB3b3VsZCBoYXZlIHRvIGJlIGFibGUKIyB0byBwYXJzZSBzaGVsbCB3
b3JkcywgdG8gZXh0cmFjdCB3b3JkJ3MgaGFs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