From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22264 invoked by alias); 22 Jul 2018 08:05:24 -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: List-Unsubscribe: X-Seq: 43199 Received: (qmail 3029 invoked by uid 1010); 22 Jul 2018 08:05:24 -0000 X-Qmail-Scanner-Diagnostics: from mail-oi0-f54.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.218.54):SA:0(-1.7/5.0):. Processed in 1.899535 secs); 22 Jul 2018 08:05:24 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: saverio.pub2@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=wFRDS/zOoDxE7NJObAJnmI7iuOh7sxmfB3o0zzifajs=; b=Lrobebmu4V+x3KXvD+XO9lt/Tyggc9xvjF7C/74fBlFQvPHLxVxns8x4aQyj/140MG m+F6taagPscQNp0s2g/RTNeKRAtcfrQXOSflimDmxH03VA1bKqeFlEqivMHtmZBj1yH8 X8o0yJPCcZWSZ1zivh3DQwsebVhlBj1tX+eSagye3MyzHAagediV8F/T/T42RRGoMA9y FCpjHg//uPgocUb02ZzhwOFdyJH2gQ1A5wF1kkFPm5O99TsNgVIFAxPcshrxLyMQ0ZJu Ar31Kdjjz+LzCLS4FpDYNsotCmznbsMCqM3m33/SZQGtNqPzouGHSfWUOgy2JitXY3za SVyQ== X-Gm-Message-State: AOUpUlGQ0UnvUGoIzxTU0ee4ukRMJGxEP+NRMGgKY9fheqn0nTzZ3PyY jzlc3s/CiSkRJzKqC4sTcAm7l1n8UBpq9NGfERJnIqA2 X-Google-Smtp-Source: AAOMgpf3CGiHnKQPVeqgAezftz61DuoJTx6WWTuPJLRPqhMxwpRwbQXJsdbQG3/OIh+kD/TKEhBdLu7dSf2wyX3CMWA= X-Received: by 2002:aca:6c4f:: with SMTP id h76-v6mr4355730oic.214.1532246718860; Sun, 22 Jul 2018 01:05:18 -0700 (PDT) MIME-Version: 1.0 From: Sav Erio Date: Sun, 22 Jul 2018 10:05:08 +0200 Message-ID: Subject: Perplexing `COMP_POINT` value on bashcompinit tab completion (plaintext) To: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" (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 ``` 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 ``` 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