Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.0
Date: Fri, 15 Jan 2016 06:26:46 +0000
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: _history-complete-older problems with $(
Message-ID: <20160115062646.GB13897@tarsus.local2>
References: <CAKc7PVCnEX1rEhNqhtx7spyUVKCWukz4Tzkqr27-OV9+4hVciQ@mail.gmail.com>
 <CAKc7PVDVR=B8SWX+gSiNvtODWZ-25LtDz7jXVDH8BtrcxMnjXQ@mail.gmail.com>
 <160111161501.ZM5305@torch.brasslantern.com>
 <CAKc7PVBCEM=46YmgmhPR==Rq+pSfY+hgr8bcOMLV=zLFm6THBg@mail.gmail.com>
 <160112113928.ZM9065@torch.brasslantern.com>
 <20160113010147.GA4699@tarsus.local2>
 <160112180141.ZM9984@torch.brasslantern.com>
 <CAKc7PVBz1nNueRmEfyz3157kvJjEgHW3wmSXraKM+-9P-i5Atw@mail.gmail.com>
 <CAKc7PVAdLiKGvay412eLo=0jCpRB9PktAkAVj08sE=gjZ=4nQw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <CAKc7PVAdLiKGvay412eLo=0jCpRB9PktAkAVj08sE=gjZ=4nQw@mail.gmail.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Seq: zsh-workers 37636

Sebastian Gniazdowski wrote on Thu, Jan 14, 2016 at 10:52:14 +0100:
> PS. I used the "find LBUFFER myself" approach to handle following case
> better ("|" is cursor):
> 
> % $(( 0 |+ 1 ))
> 
> Doing ${(z)LBUFFER} and then (z) on right part of BUFFER would produce
> SUFFIX="+" instead of "+ 1 ))".  If I find the word in ${(z)BUFFER}
> and divide it into two halves myself, then I have PREFIX="$(( 0 "
> SUFFIX "+ 1 ))". However, following case works better with LBUFFER
> approach:
> 
> % ${|a some other $words
> 
> With LBUFFER approach, PREFIX="${" SUFFIX="a" and that's better than
> PREFIX="${" SUFFIX="a some other $words". I can of course respect
> no_complete_in_words and do PREFIX="${a" SUFFIX="".
> 
> I'm currently looking for a way to choose better strategy, maybe
> someone has some ideas?

You could have the widget try both strategies.

