Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Perplexing `COMP_POINT` value on bashcompinit tab completion (plaintext)
- X-seq: zsh-workers 43199
- From: Sav Erio <saverio.pub2@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Perplexing `COMP_POINT` value on bashcompinit tab completion (plaintext)
- Date: Sun, 22 Jul 2018 10:05:08 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=wFRDS/zOoDxE7NJObAJnmI7iuOh7sxmfB3o0zzifajs=; b=toZ6fFeL+qbxUjMkTzemCfsCt7AwVyGyFW78iaBnorCzKJztfV5t1JdUPlk8QJZcN7 HR8lwIQMeFIbGaIO6DVGzJ/ezPUHKrVDqxZCl5zWUz/x0fnvYN0Py5qyHVlc/OqIImu8 Ot0YLBmKLqp3xNAXOiQOAbItjc4WNT/pwjTmVwHPFh7ASanMneXSwFQv5bMnVTHYGAcl Tu8enPgsPI4L1js7S+sH1RfGmjH/9F9KstQvdHzVk2TaXGR3bbXzC2wzxD4pP1oQ5myu oxtn7NPwgC2vOVVQOc8Wst4Fh7htNv4tP5dalaFcDNmp5RHBWSqVoRoW/1FQw4Pnq/dr kOFg==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
(I've previously sent this email from my email client, which sends in
HTML; this has apparently didn't work well with the mailing list
software, so I'm resending it from the Gmail web app, which should be
plaintext).
=====
Hello!
I use the OMZ/`bashcompinit` combination in order to write my tab
completion scripts.
The tab completion itself works, however, I'm writing more complex
scripts, and I find the `COMP_POINT` value perplexing, since it
doesn't match the intuitive value (the position of the cursor in the
string, which is what Bash returns).
Let's suppose you have a script named `/home/oooh_my_tab/scr`, whose
autocompletion is defined via `complete -C
"/path/to/myscript_completion" -o default scr`.
When typing:
```sh
$ scr <tab>
```
Bash sends to the completion script the env vars `COMP_LINE=scr ` and
`COMP_POINT=4`. The number `4` is, intuitively, the position of the
cursor (and the size of the `COMP_LINE` string).
Zsh sends `COMP_LINE=/home/oooh_my_tab/scr `, which is different while
correct nonetheless, but sends `COMP_POINT=23`, which is perplexing,
since the position of the cursor is `22`.
When typing:
```sh
$ scr a<tab>
```
Bash sends `COMP_LINE=scr a` and `COMP_POINT=5`, which, again, has
intuitive values.
Zsh sends `COMP_LINE=/home/oooh_my_tab/scr a`, and the now more
perplexing `COMP_POINT=25`, which adds an unexpected extra unit to
what was, in the previous example, an already apparently off-by-one
value.
Is this a bug? Am I missing something? With such behavior,
`COMP_POINT` breaks compatibility with Bash tab completion scripts.
Thanks,
Saverio
Messages sorted by:
Reverse Date,
Date,
Thread,
Author