From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29312 invoked by alias); 17 Jun 2016 22:51:20 -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: X-Seq: 38710 Received: (qmail 10448 invoked from network); 17 Jun 2016 22:51:20 -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.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=YwOYp1mu/6vTPxzlaVwMuzoEzmFILAVQhP7vzkng0KU=; b=tv5kt4j+OcJCHx+Jwl78rkwqpLtUADu0K0IWxzJa4C5nCUGu2GMk9QV4sLLPbdAJ9x 5uiD3J67R1582h32t6QKKoHYg0OAYFn9yAxniOSVN43Fdf94uWIQJtIMbJJDRzzcVoYV pCj7E0k7shNc/AeTH7sl1UJ8/IQc5m242iPBMnNwnDDwiE6tAZvg9Y1aapfAE3uAzmIU ZHkBXUapObolwJY2Q5r2lRBhh0fFwju4my+H0RbrildWI7QXU9me4rp9H4a1jrKyqeBi mbBLxO/UMP7s9n8LDl4KUO5l7tOt1qDUm7n3F+4iu37c51J5rplbaDKkTwX7h1kPviZA omDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=YwOYp1mu/6vTPxzlaVwMuzoEzmFILAVQhP7vzkng0KU=; b=Vhdyo3uYqAyWrOIBGhH750gMhkgeFaUzbhc51BkxPEH0eU+uy8gUDHnmTCASo6FRsy 57zLOzRqNRHxYUhFgF0t0q6sV3ETqRufCpoEFP3GFWEu0OXAzy0A4iCCv5ECzg8ltBmA RvySWSJGN9xIn93/tN8F1Zu6ZGQp0c1Nm2KfpgicZJ7F2FSSXGHLB/p0mJ2YKbci5SO8 6tlHuU95jNRWeptcLmRANpU7gNDo8Ou0CKRuynFLM0F1ZL8AsZmhKYV4sxTDXCg8zBva 4AkuutER+xlKAMtL5O/cfF0/D3gkNr9rIetrX+2jn+Ba9c8zyKGbcPG4HMbhxR8mrnd+ Oz/Q== X-Gm-Message-State: ALyK8tLBFrrX3+yhQFUCi+qXzuGeZ/DaKHRHGWJIwkwnk/6Yjs0O/bpdBkXaR0SU0YwwMg== X-Received: by 10.98.87.138 with SMTP id i10mr5067730pfj.1.1466203876569; Fri, 17 Jun 2016 15:51:16 -0700 (PDT) From: Bart Schaefer Message-Id: <160617155143.ZM1434@torch.brasslantern.com> Date: Fri, 17 Jun 2016 15:51:43 -0700 In-Reply-To: <770131466191140@web6j.yandex.ru> Comments: In reply to "Nikolay Aleksandrovich Pavlov (ZyX)" "Brace list completion errors when pre-brace word contains escaped characters" (Jun 17, 10:19pm) References: <770131466191140@web6j.yandex.ru> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh hackers list Subject: Re: Brace list completion errors when pre-brace word contains escaped characters MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Completion inside braces is extremely difficult, because braces are a form of expansion that turns one word into multiple words. To "correctly" do completion in braces, it's necessary to first expand to all the possible individual words, try them against the source data (e.g., list of files), collect all the new suffixes, remove the part of the prefix that was orginally outside the braces, use the remaining prefix to figure out where the commas should be placed, and finally either insert or list the possible suffixes. The first problem is that the first step -- expand to all the possible new words -- has to process/remove the backslashes or other special characters to accurately match e.g. file names. It becomes impossible to do any simple comparisons to find the new suffixes or the original common prefix, much less figure out where to relocate the commas. There are similar problems with completing special characters elsewhere; in those cases you might notice that completion discards one form of quoting in favor of another, just to simplify the result enough to be able to rebuild the command line. This doesn't work with braces, so the problem is magnified. Now consider what happens if you have two sets of braces on the line, or are asked to complete-in-word in a set of braces in the middle of a line, or both, and so on. Volunteers to dive into the C code and do a better job of implementing this, are encouraged.