From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Thomas Lauer <thomas.lauer@virgin.net>
Cc: zsh-users@zsh.org
Subject: Re: zstyle ':completion:*' menu select=4 interactive
Date: Mon, 16 Nov 2020 17:47:24 +0000 [thread overview]
Message-ID: <20201116174724.29df11d1@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <20201114103621.50ca012e079ba3bcd78a25a4@virgin.net>
Thomas Lauer wrote on Sat, 14 Nov 2020 10:36 +0000:
> Here's another long-standing problem I am having with zsh. I have
> googgled for hours but found nothing (Google search these days is like
> a cat: it brings home loads of things it thinks will please you but
> which are not really what you were looking for. Google just knows
> better than we do what we're searching for... But I digress.).
>
> I have the subject line in my .zshrc (BTW this is 5.7.1). The tab is
> bound to expand-or-complete-prefix. The trouble starts when the
> interactive part of this kicks in, ie there are four or more items (if
> there are fewer, all works fine) and if the cursor is somewhere in the
> middle of a line I am editing.
>
> So I do get the menu and I start navigating, with my current choice
> being copied into the line that's edited. The problem is that this
> choice overwrites part of the line I am editing. Consider this:
>
> $ bla D<tab> somestuff # cursor behind the D when I press tab)
>
> I get a few choices (say "D1/ Documents/ Dz2/ Dz3/ ..."), but nothing is
> as yet inserted into the line. Now I press <right> and "Documents/" gets
> inserted, overwriting the first few characters of somestuff. The line
> now looks like this:
>
> $ bla Documents/estuff # cursor behind the /)
>
What happens if you press ^L (clear-screen) at this point?
Can you reproduce this from 'zsh -f'?
> Not what I want. So I have done an ugly hack to sort of solve this:
>
> ugly() {
> [[ ! -z $RBUFFER ]] && RBUFFER=" $RBUFFER"
> zle expand-or-complete-prefix
> }
> ...
> zle -N ugly
>
> with ugly() bound to the tab key. This (sort of) works but it's
> pretty 'orrible.
>
Well, for starters:
ugly() {
local save_RBUFFER=$RBUFFER
RBUFFER=
{ zle expand-or-complete-prefix -- "$@" } always { RBUFFER=$save_RBUFFER }
}
Not tested.
> I'm sure the zsh gurus have an idea what's going on here and can
> point out the problem :-)
>
next prev parent reply other threads:[~2020-11-16 17:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-14 10:36 Thomas Lauer
2020-11-16 17:47 ` Daniel Shahaf [this message]
2020-11-17 11:34 ` Thomas Lauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201116174724.29df11d1@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=thomas.lauer@virgin.net \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).