From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 7487 invoked from network); 17 Nov 2020 11:35:35 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 17 Nov 2020 11:35:35 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1605612935; b=nlhc//38jm28NvM9VIoeRVOcDFbjIRkMXQ74JEGYNWiYuGMZZLC/FohYt5oVtNWTeErOwoqgfv 6vej+lJqqxeUs7FL33RRZvLDWrvwMQcR8c1P/wzi+KnNtuSuMrQgTnLccE4RCgoJCp5rIEbETE OHLcBXfvul0OMVeFye6RnWZvok7VtqG/IUWnmpfFIuMRCwjVdpygk/hPIU4M9vuarOw0WVjhEc WHchMrvN+oyx7OEicWBNS/E2AvpKk6L3N7FT7whrW0CBpOz3G15yIcTZqmuxmGK9H50UNwF3A/ cUtl4d4aBBS3OElYDbfV2uisWRfuxjdfZUhQoL1A1A1KVA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (know-smtprelay-omc-7.server.virginmedia.net) smtp.remote-ip=80.0.253.71; dkim=pass header.d=virgin.net header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=virgin.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1605612935; bh=eMU9pO8E8jIYNU6xI5IG+rSEA75uKd0eyAzDV/lKNrw=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version: In-Reply-To:References:Message-ID:Date:Subject:Cc:To:From:DKIM-Signature: DKIM-Signature; b=ccePyY32Esxp5609Kw12YhBOn2L187Nt/1PdX1RXUXn+8iCXg3m24m7HGFaQcVHyF/y+CxoGhj 8CCduBv77D3lPNvtrxDdZaE9DRsrhkDU0CG4/0yQm2rVeb9IGoKKRyq9wY/Ha0iNIvTUH1Xy3f NnV4uhAvYtMHAhQdm2ke9kCmgG1bgMQbofop/ThEGYHkiJgaBS3sMsV9z4HwRMFBTTUa6irE3a GI/UoeWFXqPLFnEUMeDQc/oK8yEQdfFS02GVVOB10sN3pEy9//WB2x0IiaVkdUiphXeFDfe8CO +YF459tJe4Zh0GVmEfuBsS11LPMJ4uzkGPCXDEIKPg59eg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:In-Reply-To:References:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=Wa1wj76MlZ+TQn9HjXQz+nfg6Zl/D4Rxk5Y8K65Vg4c=; b=bGX7thQEYdavoWd10+7jP/6Kw8 xpuR696t6pDaoWIsRY7Rd4EIvzedBH2n9qO8PfP2SSmoabw3NuRk37KxjlySU5nSfsr2urs+nv/Qs NCfxMeTu4dH9JRP4IkejGNKBp9yhwtkfQwrxolzHiGaDOMrNSZIVB5YIo+jLrV8JoLUFQqDArXCqB lmS6A6rLJEq1+wTIdCMAKCUxec7hmuCZOkWWD4Zq6OY1GWtsZyN5eEAbGnqrvb44aukNRQD+zItKd Qx7XKJluztvBb0ChIoHcY/kdpZ5WY4gS/khyOaPlKGGxllmkBTR4zELp8IJ5Nw9GLBBU1voNZtTyT cejiN9Cg==; Received: from authenticated user by zero.zsh.org with local id 1kezGh-000I7C-P2; Tue, 17 Nov 2020 11:35:27 +0000 Authentication-Results: zsh.org; iprev=pass (know-smtprelay-omc-7.server.virginmedia.net) smtp.remote-ip=80.0.253.71; dkim=pass header.d=virgin.net header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=virgin.net; arc=none Received: from know-smtprelay-omc-7.server.virginmedia.net ([80.0.253.71]:33489) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1kezGD-000HkJ-U1; Tue, 17 Nov 2020 11:34:58 +0000 Received: from win7vbox.rt ([92.4.64.56]) by cmsmtp with ESMTPA id ezGCkOFrkzNL5ezGCkAaRQ; Tue, 17 Nov 2020 11:34:57 +0000 X-Originating-IP: [92.4.64.56] X-Authenticated-User: thomas.lauer@virgin.net X-Spam: 0 X-Authority: v=2.3 cv=VOHzYeHX c=1 sm=1 tr=0 a=RABglsRdiJrqaSL+q5ZWmw==:117 a=RABglsRdiJrqaSL+q5ZWmw==:17 a=kj9zAlcOel0A:10 a=4S04WFU1Lep5DeuxctQA:9 a=CjuIK1q_8ugA:10 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virgin.net; s=meg.feb2017; t=1605612897; bh=Wa1wj76MlZ+TQn9HjXQz+nfg6Zl/D4Rxk5Y8K65Vg4c=; h=From:To:Cc:Subject:Date:References:In-Reply-To; b=MsuKHo1AdiDdHTAuJFyH3Ai/hvmAJJpVHfq5V9DaJuARDbrR1x1NhPkYNrU5W4IPB msXqdSMhYGLM+Yyt1naP9men34tbOBu3bhyFULSOchJDuLH9UCiRGlQLEe2K4XK6Vd ZNIfuuk83cIAEVv2mt65T1jseAErOhkMEiM/e9Hw3XN5qyOdBUrMqK9+sOdNhoBCDd QF04/zvWYBwFRMCWe7ushJWRwlaW8FnttQv/X+x/YQrV0ZxX/JVAFTrxrs8H1Q+c/M DJnyvG1S8HocaKNGEDponYnW0QpATTkqrSqT2b2Ioa7PMRnFkSuuWUcbfZScXSJWBs 1T4emz2cM9fqA== From: Thomas Lauer To: Daniel Shahaf Cc: zsh-users@zsh.org Subject: Re: zstyle ':completion:*' menu select=4 interactive Date: Tue, 17 Nov 2020 11:34:58 +0000 Organization: TL Message-ID: References: <20201114103621.50ca012e079ba3bcd78a25a4@virgin.net> <20201116174724.29df11d1@tarpaulin.shahaf.local2> In-Reply-To: <20201116174724.29df11d1@tarpaulin.shahaf.local2> User-Agent: ForteAgent/7.00.32.1200 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-CMAE-Envelope: MS4wfH71yXtaGyA85pLl2YV6OBv1o8U/+VCTZ+x/3U0ECwZAkQf8OAnMgI3JT5PLOLKvbMhcIH31L7ul4yd6VYLzuUVx2NT1ip8eAvipAv8lyVIAsHB+qjgd AqHwwAJEISiJzYALJFv1GR1yrtQt4Lpz7GRT03ZVMRbUlDoiMXGuDmzty96cOPJLkkBUdEGmiCjhOnwJRdOzxLNrN/tJbWds5Ig= X-Seq: 26179 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: Daniel Shahaf wrote on Mon, 16 Nov 2020 17:47:24 +0000: > 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.). > >=20 > > 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. > >=20 > > 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: > >=20 > > $ bla D somestuff # cursor behind the D when I press tab) > >=20 > > I get a few choices (say "D1/ Documents/ Dz2/ Dz3/ ..."), but nothing= is > > as yet inserted into the line. Now I press and "Documents/" = gets > > inserted, overwriting the first few characters of somestuff. The line > > now looks like this: > >=20 > > $ bla Documents/estuff # cursor behind the /) > >=20 >=20 > What happens if you press ^L (clear-screen) at this point? The screen clears and the prompt and line are reprinted with the same problem. > Can you reproduce this from 'zsh -f'? Well, a bare -f doesn't do interactive menus so the problem doesn't occur. I've tried to create a minimal .zshrc that shows the problem but have not got very far. > > Not what I want. So I have done an ugly hack to sort of solve this: > >=20 > > ugly() { > > [[ ! -z $RBUFFER ]] && RBUFFER=3D" $RBUFFER" > > zle expand-or-complete-prefix > > } =20 > > ... > > zle -N ugly > >=20 > > with ugly() bound to the tab key. This (sort of) works but it's > > pretty 'orrible. > >=20 >=20 > Well, for starters: >=20 > ugly() { > local save_RBUFFER=3D$RBUFFER > RBUFFER=3D > { zle expand-or-complete-prefix -- "$@" } always { = RBUFFER=3D$save_RBUFFER } > } >=20 > Not tested. That's nifty. I've combined it with my ugly hack as I've now done more than enough attempts to analyse this thing and have realised that zsh is always overwriting the first three characters, no matter how long the inserted string is. So the final version is: ugly() { local save_RBUFFER=3D$RBUFFER RBUFFER=3D" $RBUFFER" { zle expand-or-complete-prefix -- "$@" } always { = RBUFFER=3D$save_RBUFFER } } Works perfect :-) And thanks for the help. --=20 Tom