Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _history-complete-older problems with $(



On 13 January 2016 at 03:01, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> 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 )) $(( 試句相當長 ""  $(( 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 ))          ( 試句相當長 ""

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/657d6a591bea5d26fbed88176ac7de80e8d73927/widen_for_history

Best regards,
Sebastian Gniazdowski

Attachment: widen_for_history
Description: Binary data



Messages sorted by: Reverse Date, Date, Thread, Author