about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2014-03-03 23:52:20 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2014-03-03 23:52:20 -0800
commitff6d8115efaa8d50ec107508c8678ec49d300ed6 (patch)
treef05ff427c1665d115c903f2f203359f9f730f4c7
parente6d99759e8aff6f17ff08d977c7e7471ac0ebec5 (diff)
parent3c25cb29aba4d4c1a907aa29db48c36d8dbac18e (diff)
downloadzsh-ff6d8115efaa8d50ec107508c8678ec49d300ed6.tar.gz
zsh-ff6d8115efaa8d50ec107508c8678ec49d300ed6.tar.xz
zsh-ff6d8115efaa8d50ec107508c8678ec49d300ed6.zip
Merge branch 'master' of git://git.code.sf.net/p/zsh/code
-rw-r--r--.gitignore1
-rw-r--r--ChangeLog53
-rw-r--r--Completion/Base/Completer/_extensions33
-rw-r--r--Completion/Base/Core/_main_complete8
-rw-r--r--Doc/Makefile.in10
-rw-r--r--Doc/Zsh/compsys.yo18
-rw-r--r--Src/Zle/complist.c17
-rw-r--r--Src/Zle/zle_hist.c4
-rw-r--r--Src/Zle/zle_params.c2
9 files changed, 124 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index 5fd574b1f..4ae315baa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,6 +39,7 @@ Doc/intro.a4.ps
 Doc/intro.us.pdf
 Doc/intro.us.ps
 Doc/version.yo
+Doc/texi2html.conf
 Doc/zsh*.1
 Doc/zsh.texi
 Doc/zsh.info*
diff --git a/ChangeLog b/ChangeLog
index 7ae7e8740..839e5af69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,25 @@
 2014-03-03  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* users/18550: Doc/Zsh/compsys.yo: matcher-list clarifications
+2014-03-03  Simon Ruderich  <simon@ruderich.org>
+
+	* 32289: Doc: Add zsh version to footer in HTML documentation.
+
+2014-03-03  Oliver Kiddle  <opk@zsh.org>
+
+	* 32441: Completion/Base/Completer/_extensions, Doc/Zsh/compsys.yo:
+	add completer for file extensions
+
+	* 32450: Src/Zle/zle_hist.c: make get-line set the history
+	number that was saved with the line
+
+	* 32448: Src/Zle/zle_params.c: fix seg fault after recursive-edit
+
+	* 32439 (with Yuri D'Elia): Completion/Base/Core/_main_complete:
+	add new show-ambiguity style
+
+	* 32436: Src/Zle/complist.c: allow = to be used in ZLS_COLORS
+	patterns if it is quoted or inside parentheses
 
 2014-03-01  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
@@ -22,7 +41,7 @@
 	Completion/Unix/Command/_rm: improved quoting for ignore-line
 	style.
 
-2014-02-24  Oliver Kiddle <opk@zsh.org>
+2014-02-24  Oliver Kiddle  <opk@zsh.org>
 
 	* unposted: Doc/Zsh/compsys.yo: fix typo
 
@@ -104,7 +123,7 @@
 	* 32388: Doc/Zsh/mod_zutil.yo, Src/Modules/zutil.c: zparseopts -K
 	preserves individual associative array elements
 
-2014-02-14  Oliver Kiddle <opk@zsh.org>
+2014-02-14  Oliver Kiddle  <opk@zsh.org>
 
 	* 32361: Src/Zle/zle_tricky.c: don't reset lastline before completion
 
@@ -122,7 +141,7 @@
 
 	* Martin Vaeth: 32356: Util/helpfiles: fix a typo.
 
-2014-02-05  Oliver Kiddle <opk@zsh.org>
+2014-02-05  Oliver Kiddle  <opk@zsh.org>
 
 	* 32355: Doc/Zsh/zle.yo Test/X02zlevi.ztst Test/comptest: document
 	and test vi mode undo changes
@@ -157,7 +176,7 @@
 	unset for better compatibility in emulation modes; for the same
 	reason, remove the readonly flag from $_
 
-2014-01-31  Oliver Kiddle <opk@zsh.org>
+2014-01-31  Oliver Kiddle  <opk@zsh.org>
 
 	* 32314: Src/Zle/zle_main.c, Src/Zle/zle_tricky.c,
 	Src/Zle/zle_utils.c, Src/Zle/zle_vi.c: merge undo events
@@ -1564,7 +1583,7 @@
 	* users/17665: Doc/Zsh/options.yo, Src/math.c, Src/options.c,
 	Src/zsh.h, Test/C01arith.ztst: add FORCE_FLOAT option.
 
-2013-02-27  Oliver Kiddle <opk@zsh.org>
+2013-02-27  Oliver Kiddle  <opk@zsh.org>
 
 	* 31076: Completion/Linux/Command/_yast,
 	Completion/Unix/Type/_pids, Completion/Unix/Type/_pdf:
@@ -1585,7 +1604,7 @@
 	* 31060: Src/builtin.c: "+" before a flag for "functions" or
 	"autoload" should suppress display of function body.
 
-2013-02-21  Oliver Kiddle <opk@zsh.org>
+2013-02-21  Oliver Kiddle  <opk@zsh.org>
 
 	* 31058: Completion/Zsh/Command/_fc, Completion/Unix/Command/_cut,
 	Completion/Unix/Command/_sed, Completion/Unix/Command/_wget,
@@ -1597,7 +1616,7 @@
 	* 31055: Completion/compaudit: missing '$' in search of /proc
 	file system.
 
-2013-02-12  Oliver Kiddle <opk@zsh.org>
+2013-02-12  Oliver Kiddle  <opk@zsh.org>
 
 	* 31041: Test/comptest, Test/X02zlevi.ztst: add support for
 	testing line editor widgets from the test suite
@@ -1605,7 +1624,7 @@
 	* unposted: Etc/zsh-development-guide: remove duplication in
 	git guidelines
 
-2013-02-09  Oliver Kiddle <opk@zsh.org>
+2013-02-09  Oliver Kiddle  <opk@zsh.org>
 
 	* Morita Sho: 31038: Completion/Unix/Type/_terminals:
 	add location of terminfo entries on Debian
@@ -1662,7 +1681,7 @@
 	modifiers :wq operating on an empty string crashed the shell.
 	The shell isn't supposed to crash.
 
-2013-01-20  Oliver Kiddle <opk@zsh.org>
+2013-01-20  Oliver Kiddle  <opk@zsh.org>
 
 	* 30987: Completion/X/Command/_xrandr: only call xrandr when
 	necessary and use _call_program
@@ -1720,7 +1739,7 @@
 
 	* unposted: Config/version.mk: zsh 5.0.1.
 
-2012-12-18  Oliver Kiddle <opk@zsh.org>
+2012-12-18  Oliver Kiddle  <opk@zsh.org>
 
 	* 30877: Etc/zsh-development-guide: document git workflow
 
@@ -1754,7 +1773,7 @@
 	* users/17445: Src/math.c, Test/C01arith.ztst: fix handling of
 	leading zeroes in floating point.
 
-2012-11-20  Oliver Kiddle <opk@zsh.org>
+2012-11-20  Oliver Kiddle  <opk@zsh.org>
 
 	* 30811: Completion/Linux/Command/_btrfs,
 	Completion/Unix/Command/_mount: new completion for btrfs and
@@ -1769,7 +1788,7 @@
 	* users/17042: Src/jobs.c: don't stomp the environment in "jobs -Z"
 	unless we've first copied it to new memory.
 
-2012-11-16  Oliver Kiddle <opk@zsh.org>
+2012-11-16  Oliver Kiddle  <opk@zsh.org>
 
 	* 30802: Completion/Unix/Command/_find: add new command switches
 
@@ -1787,7 +1806,7 @@
 	* 30800: Michal Halenka: Completion/Unix/Command/_arping: fix
 	option.
 
-2012-11-12  Oliver Kiddle <opk@zsh.org>
+2012-11-12  Oliver Kiddle  <opk@zsh.org>
 
 	* 30795: Completion/Unix/Command/_xz,
 	Completion/Unix/Command/_bzip2: new xz completion, new bzip2 options
@@ -1795,7 +1814,7 @@
 	* 30794: Completion/Unix/Command/_irssi,
 	Completion/Unix/Command/_mutt: update for new options
 
-2012-11-11  Oliver Kiddle <opk@zsh.org>
+2012-11-11  Oliver Kiddle  <opk@zsh.org>
 
 	* 30793: Completion/Unix/Command/_getent,
 	Completion/Unix/Command/_iconv, Completion/Unix/Command/_ldd:
@@ -1815,7 +1834,7 @@
 	* 30780: Doc/Zsh/builds.yo: document that set -o failures are
 	hard but setopt failures are soft.
 
-2012-11-07  Oliver Kiddle <opk@zsh.org>
+2012-11-07  Oliver Kiddle  <opk@zsh.org>
 
 	* Benjamin R. Haskell: 30737: Completion/Unix/Command/_git:
 	make custom completion functions for git aliases easier
@@ -1884,7 +1903,7 @@
 	Test/C04funcdef.ztst: emulate command evaluations should apply
 	sticky emulation to autoloads, too.
 
-2012-10-07  Oliver Kiddle <opk@zsh.org>
+2012-10-07  Oliver Kiddle  <opk@zsh.org>
 
 	* unposted: Completion/Unix/Command/_webbrowser,
 	Completion/Unix/Type/_pspdf: add evince, zathura, dwb
@@ -1938,7 +1957,7 @@
 	Functions/VCS_Info/Backends/VCS_INFO_detect_fossil: Fix fossil
 	detection on unix
 
-2012-09-28  Oliver Kiddle <opk@zsh.org>
+2012-09-28  Oliver Kiddle  <opk@zsh.org>
 
 	* 30697: Completion/Unix/Command/_dbus: new completion definition
 
diff --git a/Completion/Base/Completer/_extensions b/Completion/Base/Completer/_extensions
new file mode 100644
index 000000000..8b6c4fd6a
--- /dev/null
+++ b/Completion/Base/Completer/_extensions
@@ -0,0 +1,33 @@
+#autoload
+
+# This completer completes filename extensions when completing
+# after *. or ^*. It can be used anywhere in the completer list
+# but if used after _expand, patterns that already match a file
+# will be expanded before it is called.
+
+compset -P '(#b)([~$][^/]#/|)(*/|)(\^|)\*.' || return 1
+
+local -aU files
+local -a expl suf mfiles
+
+files=( ${(e)~match[1]}${match[2]}*.* ) || return 1
+eval set -A files '${(MSI:'{1..${#${(O)files//[^.]/}[1]}}':)files%%.[^/]##}'
+files=( ${files:#.<->(.*|)} )
+
+if zstyle -t ":completion:${curcontext}:extensions" prefix-hidden; then
+  files=( ${files#.} )
+else
+  PREFIX=".$PREFIX"
+  IPREFIX="${IPREFIX%.}"
+fi
+
+zstyle -T ":completion:${curcontext}:extensions" add-space ||
+  suf=( -S '' )
+
+_description extensions expl 'file extension'
+
+# for an exact match, fail so as to give _expand or _match a chance.
+compadd -O mfiles "$expl[@]" -a files
+[[ $#mfiles -gt 1 || ${mfiles[1]} != $PREFIX ]] &&
+    compadd "$expl[@]" "$suf[@]" -a files &&
+    [[ -z $compstate[exact_string] ]]
diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete
index 8dd781dbb..e881ea6a1 100644
--- a/Completion/Base/Core/_main_complete
+++ b/Completion/Base/Core/_main_complete
@@ -334,6 +334,14 @@ elif [[ nm -eq 0 && -z "$_comp_mesg" &&
   compadd -x "$mesg"
 fi
 
+if zstyle -s ":completion:${curcontext}:" show-ambiguity tmp; then
+  local prefix=${${compstate[unambiguous]}[1,${compstate[unambiguous_cursor]}-1]}
+  local toquote='[=\(\)\|~^?*[\]#<>]'
+  [[ $tmp = (yes|true|on) ]] && tmp=4
+  [[ -n $prefix ]] &&
+    _comp_colors+=( "=(#i)${prefix[1,-2]//?/(}${prefix[1,-2]//(#m)?/${MATCH/$~toquote/\\$MATCH}|)}${prefix[-1]//(#m)$~toquote/\\$MATCH}(#b)(?|)*==$tmp" )
+fi
+
 [[ "$_comp_force_list" = always ||
    ( "$_comp_force_list" = ?*  && nm -ge _comp_force_list ) ]] &&
     compstate[list]="${compstate[list]//messages} force"
diff --git a/Doc/Makefile.in b/Doc/Makefile.in
index af0a2b5da..c86f34947 100644
--- a/Doc/Makefile.in
+++ b/Doc/Makefile.in
@@ -41,7 +41,8 @@ LN_S            = @LN_S@
 MAKEINFO = makeinfo
 TEXI2DVI = texi2dvi
 DVIPS = dvips
-TEXI2HTML = @TEXI2HTML@ --output . --ifinfo --split=chapter --node-files
+TEXI2HTML = @TEXI2HTML@ --output . --ifinfo --split=chapter --node-files \
+            --init-file $(sdir)/texi2html.conf
 
 .SUFFIXES: .yo .1
 
@@ -159,7 +160,7 @@ zsh_a4.ps: zsh.dvi
 html: zsh_toc.html
 .PHONY: html
 
-zsh_toc.html: $(sdir)/zsh.texi
+zsh_toc.html: $(sdir)/zsh.texi $(sdir)/texi2html.conf
 	$(TEXI2HTML) $(sdir)/zsh.texi
 
 zshall.1: zsh.yo
@@ -248,6 +249,10 @@ version.yo: $(sdir_top)/Config/version.mk
 	  echo 'IFDEF(DECWSLEVEL)(DECWSLEVEL())(ENDDEF())#' | tr '#' '\\'; \
 	) > $(sdir)/version.yo
 
+texi2html.conf: $(sdir_top)/Config/version.mk
+	echo '$$PRE_BODY_CLOSE = "<font size=\"-1\">Zsh version $(VERSION), released on $(VERSION_DATE).</font>";' \
+	    > $(sdir)/$@
+
 Zsh/modlist.yo: $(MODDOCSRC)
 	( \
 	    echo "startitem()"; \
@@ -388,6 +393,7 @@ clean-here:
 	rm -f *.aux *.cp *.cps *.fn *.fns *.ky *.log
 	rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs
 	rm -rf infodir
+	rm -f texi2html.conf
 .PHONY: clean-here
 
 distclean-here: clean-here
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 7dacbcf7b..8a9f47db1 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -2442,6 +2442,15 @@ completing words for the dict command. It allows words from different
 dictionary databases to be added separately.
 The default for this style is `false'.
 )
+kindex(show-ambiguity, completion style)
+item(tt(show-ambiguity))(
+If the tt(zsh/complist) module is loaded, this style can be used to
+highlight the first ambiguous character in completion lists. The
+value is either a color indication such as those supported by the
+tt(list-colors) style or, with a value of tt(true), a default of
+underlining is selected. The highlighting is only applied if the
+completion display strings correspond to the actual matches.
+)
 kindex(show-completer, completion style)
 item(tt(show-completer))(
 Tested whenever a new completer is tried.  If it is true, the completion
@@ -3040,6 +3049,15 @@ This function is also a bindable command, see
 ifzman(the section `Bindable Commands' below)\
 ifnzman(noderef(Bindable Commands)).
 )
+findex(_extensions)
+item(tt(_extensions))(
+If the cursor follows the string `tt(*.)', filename extensions are
+completed. The extensions are taken from files in current directory or a
+directory specified at the beginning of the current word. For exact matches,
+completion continues to allow other completers such as tt(_expand) to
+expand the pattern. The standard tt(add-space) and tt(prefix-hidden)
+styles are observed.
+)
 findex(_history)
 item(tt(_history))(
 Complete words from the shell's command  history.  This completer 
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index b852ee99f..5e5ba9f20 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -383,12 +383,25 @@ getcoldef(char *s)
     } else if (*s == '=') {
 	char *p = ++s, *t, *cols[MAX_POS];
 	int ncols = 0;
+	int nesting = 0;
 	Patprog prog;
 
 	/* This is for a pattern. */
 
-	while (*s && *s != '=')
-	    s++;
+	while (*s && (nesting || *s != '=')) {
+	    switch (*s++) {
+		case '\\':
+		    if (*s)
+			s++;
+		    break;
+		case '(':
+		    nesting++;
+		    break;
+		case ')':
+		    nesting--;
+		    break;
+	    }
+	}
 	if (!*s)
 	    return s;
 	*s++ = '\0';
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index bd5bc36d5..44b39d186 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -890,6 +890,10 @@ zgetline(UNUSED(char **args))
 	free(s);
 	free(lineadd);
 	clearlist = 1;
+	if (stackhist != -1) {
+	    histline = stackhist;
+	    stackhist = -1;
+	}
     }
     return 0;
 }
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index a9bbf136a..5845207fa 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -363,7 +363,7 @@ get_prebuffer(UNUSED(Param pm))
 static char *
 get_widget(UNUSED(Param pm))
 {
-    return bindk->nam;
+    return bindk ? bindk->nam : "";
 }
 
 /**/