zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: X=`cat ~/y` completion
Date: Fri, 3 Jun 2016 12:29:05 -0700	[thread overview]
Message-ID: <160603122905.ZM24555@torch.brasslantern.com> (raw)
In-Reply-To: <20160603053123.GA26773@fujitsu.shahaf.local2>

[This is more properly a -workers discussion but I'll continue on -users
because we started here.]

On Jun 3,  5:31am, Daniel Shahaf wrote:
} Subject: X=`cat ~/y` completion
}
} Consider the following two cases:
} 
} % X=`cat $HOME/t<TAB>
} % X=`cat ~/t<TAB>
} 
} In 'zsh -f' + compinit, the former works but the latter doesn't.
} I expect the latter to behave as the former does.
} 
} ---
} 
} The last related discussion seems to be 35515/35539.

I don't think those are related, completing after ~/ works elsewhere.
The real difficulty seems to follow from testing $compstate[quote] on
line 276:

}    276	elif [[ "$pre[1]" = \~ && -z "$compstate[quote]" ]]; then
}    277	
}    278	  # It begins with `~', so [...]

The word on line does begin with tilde, but that's ignored because it is
inside the backticks.

The test could be either != [\'\"] or = (|\`) but I went with the latter
because the former confuses vim syntax highlighting.


diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
index c64ebf5..14c4cc7 100644
--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -273,7 +273,7 @@ if [[ "$pre" = [^][*?#^\|\<\>\\]#(\`[^\`]#\`|\$)*/* && "$compstate[quote]" != \'
   orig="${orig[1,(in:i:)/][1,-2]}"
   donepath=
   prepaths=( '' )
-elif [[ "$pre[1]" = \~ && -z "$compstate[quote]" ]]; then
+elif [[ "$pre[1]" = \~ && "$compstate[quote]" = (|\`) ]]; then
 
   # It begins with `~', so remember anything before the first slash to be able
   # to report it to the completion code. Also get an expanded version of it


  reply	other threads:[~2016-06-03 19:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-03  5:31 Daniel Shahaf
2016-06-03 19:29 ` Bart Schaefer [this message]
2016-06-03 20:46   ` Daniel Shahaf

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=160603122905.ZM24555@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --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).