summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2013-12-20 22:09:32 +0100
committerAxel Beckert <abe@deuxchevaux.org>2013-12-20 22:09:32 +0100
commit59152a34666d43575fe2f0bb7c11ef285c9be51f (patch)
tree54ae214efb56706c0e2c647b65dfcad3828d690e
parent3e96d261c83af40534acbf79c5d236ecf38af9fe (diff)
parent58614f16693a741396840fbb3db0f9ba1e53cfcb (diff)
downloadzsh-59152a34666d43575fe2f0bb7c11ef285c9be51f.tar.gz
zsh-59152a34666d43575fe2f0bb7c11ef285c9be51f.zip
New upstream release
-rw-r--r--ChangeLog52
-rw-r--r--Completion/Zsh/Type/_command_names6
-rw-r--r--Completion/compaudit2
-rw-r--r--Config/version.mk4
-rw-r--r--Doc/Zsh/params.yo13
-rw-r--r--Etc/FAQ.yo2
-rw-r--r--INSTALL2
-rw-r--r--NEWS6
-rw-r--r--README5
-rw-r--r--Src/Modules/zpty.c4
-rw-r--r--Src/Zle/zle_refresh.c51
-rw-r--r--Src/Zle/zle_tricky.c12
-rw-r--r--Src/init.c15
-rw-r--r--Src/params.c3
-rw-r--r--Src/pattern.c14
-rw-r--r--Src/zsh.h6
-rw-r--r--Test/D02glob.ztst27
-rw-r--r--Test/comptest2
18 files changed, 188 insertions, 38 deletions
diff --git a/ChangeLog b/ChangeLog
index 02722f1c0..4493d7598 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,57 @@
+2013-12-20 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted: Config/version.mk, Etc/FAQ.yo, README: release 5.0.4.
+
+2013-12-18 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 32157: Doc/Zsh/params.yo, Src/Zle/zle_refresh.c, Src/init.c,
+ Src/params.c: make ZLE_RPROMPT_INDENT a special variable tied to
+ an internal C global, to avoid having the shell variable value
+ fetched on every keystroke and to make it available when testing
+ how to reposition the cursor after the right-prompt is output.
+ Fixes erasure in completion listing when ZLE_RPROMPT_INDENT=0.
+
+ * 32150: Completion/compaudit: Reference loop variable rather
+ than absolute path in executable ownership test
+
+2013-12-17 Phil Pennock <pdpennock@users.sourceforge.net>
+
+ * 32143: INSTALL: Fix --enable-custom-patchlevel name in INSTALL
+
+2013-12-16 Barton E. Schaefer <schaefer@zsh.org>
+
+ * Jun Takimoto: 32137: Test/comptest: set pseudo-terminal speed to
+ prevent padding characters which confuse output parsing.
+
+2013-12-16 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 32136: Src/pattern.c, Src/zsh.h, Test/D02glob.ztst:
+ fix problem with +*, @*, !* when kshglob is set introduced
+ by pattern disable feature.
+
+ * unposted: NEWS: add ZLE_PROMPT_INDENT.
+
+ * Patrick Oscity + pws: 32114: Doc/Zsh/params.yo,
+ Src/Zle/zle_refresh.c, Src/Zle/zle_tricky.c: ZLE_RPROMPT_INDENT
+ allows you to make the right prompt flush if your terminal
+ supports it.
+
+2013-12-16 Barton E. Schaefer <schaefer@zsh.org>
+
+ * Jun Takimoto + Bart: 32131: Src/Modules/zpty.c: avoid infinite
+ loop reading pseudo-terminal on platforms that do not buffer pty
+ contents after child process exits
+
+2013-12-15 Barton E. Schaefer <schaefer@zsh.org>
+
+ * users/18219: Completion/Zsh/Type/_command_names: compadd -Q for
+ builtins, aliases, and reserved words to preserve special chars
+
2013-12-14 Peter Stephenson <p.w.stephenson@ntlworld.com>
+ * unposted: increment version to 5.0.3-dev-0 to avoid confusion
+ with released 5.0.3.
+
* unposted: version 5.0.3, finally.
2013-12-13 Barton E. Schaefer <schaefer@zsh.org>
diff --git a/Completion/Zsh/Type/_command_names b/Completion/Zsh/Type/_command_names
index 24933c234..d9fc62dfe 100644
--- a/Completion/Zsh/Type/_command_names
+++ b/Completion/Zsh/Type/_command_names
@@ -27,11 +27,11 @@ else
[[ "$1" = - ]] && shift
defs=( "$defs[@]"
- 'builtins:builtin command:compadd -k builtins'
+ 'builtins:builtin command:compadd -Qk builtins'
"functions:shell function:compadd -k 'functions$ffilt'"
- 'aliases:alias:compadd -k aliases'
+ 'aliases:alias:compadd -Qk aliases'
'suffix-aliases:suffix alias:_suffix_alias_files'
- 'reserved-words:reserved word:compadd -k reswords'
+ 'reserved-words:reserved word:compadd -Qk reswords'
'jobs:: _jobs -t'
'parameters:: _parameters -g "^*readonly*" -qS= -r "\n\t\- =["'
)
diff --git a/Completion/compaudit b/Completion/compaudit
index 75742a0fb..00125e4db 100644
--- a/Completion/compaudit
+++ b/Completion/compaudit
@@ -101,7 +101,7 @@ for _i_exe in $_i_exes; do
if [[ -e $_i_exe ]] ;then
if zmodload -F zsh/stat b:zstat 2>/dev/null; then
local -A _i_stathash
- if zstat -H _i_stathash /proc/$$/exe &&
+ if zstat -H _i_stathash $_i_exe &&
[[ $_i_stathash[uid] -ne 0 ]]; then
_i_owners+="u${_i_stathash[uid]}"
fi
diff --git a/Config/version.mk b/Config/version.mk
index 2b87d1aa9..b554719e9 100644
--- a/Config/version.mk
+++ b/Config/version.mk
@@ -27,5 +27,5 @@
# This must also serve as a shell script, so do not add spaces around the
# `=' signs.
-VERSION=5.0.3
-VERSION_DATE='December 14, 2013'
+VERSION=5.0.4
+VERSION_DATE='December 20, 2013'
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 9d951bb38..935fd5d86 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -1547,4 +1547,17 @@ See the completion system documentation in
ifzman(zmanref(zshcompsys))\
ifnzman(noderef(Completion System)).
)
+vindex(ZLE_RPROMPT_INDENT)
+item(tt(ZLE_RPROMPT_INDENT <S>))(
+If set, used to give the indentation between the right hand side of
+the right prompt in the line editor as given by tt(RPS1) or tt(RPROMPT)
+and the right hand side of the screen. If not set, the value 1 is used.
+
+Typically this will be used to set the value to 0 so that the prompt
+appears flush with the right hand side of the screen. This is not the
+default as many terminals do not handle this correctly, in particular
+when the prompt appears at the extreme bottom right of the screen.
+Recent virtual terminals are more likely to handle this case correctly.
+Some experimentation is necessary.
+)
enditem()
diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo
index 4e04e73ea..ce24c7cd8 100644
--- a/Etc/FAQ.yo
+++ b/Etc/FAQ.yo
@@ -301,7 +301,7 @@ sect(On what machines will it run?)
sect(What's the latest version?)
- Zsh 5.0.3 is the latest production version. For details of all the
+ Zsh 5.0.4 is the latest production version. For details of all the
changes, see the NEWS file in the source distribution.
A beta of the next version is sometimes available. Development of zsh is
diff --git a/INSTALL b/INSTALL
index 00791cd86..99895bd6c 100644
--- a/INSTALL
+++ b/INSTALL
@@ -297,7 +297,7 @@ Modified versions of zsh
If you are making local modifications to zsh, you are strongly
advised to configure with the option
- --enable-local-patchlevel="<my-mod-string>"
+ --enable-custom-patchlevel="<my-mod-string>"
so that the variable $ZSH_PATCHLEVEL indicates this is not a standard
version of the shell. The argument is arbitrary, but should indicate
diff --git a/NEWS b/NEWS
index 4d0af22f9..e4d747e01 100644
--- a/NEWS
+++ b/NEWS
@@ -53,6 +53,12 @@ file at file write time. This differs from history changes made in
the zshaddhistory hook or by the HIST_IGNORE_* options, all of which
take effect immediately on the internal history list itself.
+The parameter ZLE_RPROMPT_INDENT can be set to 0 to remove the space
+between the right hand side of the screen (this causes problems with
+some terminals). It is not special and is not set by default; the
+effect in that case is as if it was 1, as in previous versions.
+
+
Changes between 4.2 and 5.0.0
-----------------------------
diff --git a/README b/README
index c2fbf746d..0aad589a2 100644
--- a/README
+++ b/README
@@ -5,8 +5,9 @@ THE Z SHELL (ZSH)
Version
-------
-This is version 5.0.3 of the shell. This is a stable release.
+This is version 5.0.4 of the shell. This is a stable release.
There are minor new features as well as bug fixes since 5.0.2.
+5.0.3 was a short-lived release with most of the features of 5.0.4.
Installing Zsh
--------------
@@ -27,7 +28,7 @@ Zsh is a shell with lots of features. For a list of some of these, see the
file FEATURES, and for the latest changes see NEWS. For more
details, see the documentation.
-Incompatibilities between 5.0.2 and 5.0.3
+Incompatibilities between 5.0.2 and 5.0.4
-----------------------------------------
The "zshaddhistory" hook mechanism documented in the zshmisc manual page
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index fca0cc172..d119658c3 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -510,14 +510,14 @@ checkptycmd(Ptycmd cmd)
if (cmd->read != -1 || cmd->fin)
return;
- if ((r = read(cmd->fd, &c, 1)) < 0) {
+ if ((r = read(cmd->fd, &c, 1)) <= 0) {
if (kill(cmd->pid, 0) < 0) {
cmd->fin = 1;
zclose(cmd->fd);
}
return;
}
- if (r) cmd->read = (int) c;
+ cmd->read = (int) c;
}
static int
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 17b78ce59..fd5485770 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -976,7 +976,8 @@ zrefresh(void)
int tmppos; /* t - tmpline */
int tmpalloced; /* flag to free tmpline when finished */
int remetafy; /* flag that zle line is metafied */
- int txtchange; /* attributes set after prompts */
+ int txtchange; /* attributes set after prompts */
+ int rprompt_off; /* Offset of rprompt from right of screen */
struct rparams rpms;
#ifdef MULTIBYTE_SUPPORT
int width; /* width of wide character */
@@ -1573,10 +1574,19 @@ zrefresh(void)
if (!more_start) {
if (trashedzle && opts[TRANSIENTRPROMPT])
put_rpmpt = 0;
- else
+ else {
put_rpmpt = rprompth == 1 && rpromptbuf[0] &&
- !strchr(rpromptbuf, '\t') &&
- (int)ZR_strlen(nbuf[0]) + rpromptw < winw - 1;
+ !strchr(rpromptbuf, '\t');
+ if (put_rpmpt)
+ {
+ rprompt_off = rprompt_indent;
+ /* sanity to avoid horrible things happening */
+ if (rprompt_off < 0)
+ rprompt_off = 0;
+ put_rpmpt =
+ (int)ZR_strlen(nbuf[0]) + rpromptw < winw - rprompt_off;
+ }
+ }
} else {
/* insert >.... on first line if there is more text before start of screen */
ZR_memset(nbuf[0], zr_sp, lpromptw);
@@ -1631,9 +1641,9 @@ zrefresh(void)
if (put_rpmpt && !iln && !oput_rpmpt) {
int attrchange;
- moveto(0, winw - 1 - rpromptw);
+ moveto(0, winw - rprompt_off - rpromptw);
zputs(rpromptbuf, shout);
- vcs = winw - 1;
+ vcs = winw - rprompt_off;
/* reset character attributes to that set by the main prompt */
txtchange = pmpt_attr;
/*
@@ -2113,19 +2123,24 @@ moveto(int ln, int cl)
const REFRESH_ELEMENT *rep;
if (vcs == winw) {
- vln++, vcs = 0;
- if (!hasam) {
- zputc(&zr_cr);
- zputc(&zr_nl);
+ if (rprompt_indent == 0 && tccan(TCLEFT)) {
+ tc_leftcurs(1);
+ vcs--;
} else {
- if ((vln < nlnct) && nbuf[vln] && nbuf[vln]->chr)
- rep = nbuf[vln];
- else
- rep = &zr_sp;
- zputc(rep);
- zputc(&zr_cr);
- if ((vln < olnct) && obuf[vln] && obuf[vln]->chr)
- *obuf[vln] = *rep;
+ vln++, vcs = 0;
+ if (!hasam) {
+ zputc(&zr_cr);
+ zputc(&zr_nl);
+ } else {
+ if ((vln < nlnct) && nbuf[vln] && nbuf[vln]->chr)
+ rep = nbuf[vln];
+ else
+ rep = &zr_sp;
+ zputc(rep);
+ zputc(&zr_cr);
+ if ((vln < olnct) && obuf[vln] && obuf[vln]->chr)
+ *obuf[vln] = *rep;
+ }
}
}
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index e30e0b1aa..25f09c459 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1504,7 +1504,17 @@ get_comp_string(void)
nnb = s + MB_METACHARLEN(s);
else
nnb = s;
- for (tt = s; tt < s + zlemetacs_qsub - wb;) {
+ tt = s;
+ if (lincmd)
+ {
+ /*
+ * Ignore '['s at the start of a command as they're not
+ * matched by closing brackets.
+ */
+ while (*tt == Inbrack && tt < s + zlemetacs_qsub - wb)
+ tt++;
+ }
+ while (tt < s + zlemetacs_qsub - wb) {
if (*tt == Inbrack) {
i++;
nb = nnb;
diff --git a/Src/init.c b/Src/init.c
index 53c4fbd72..f5aae71f2 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -77,7 +77,7 @@ mod_export int tclen[TC_COUNT];
/**/
int tclines, tccolumns;
/**/
-mod_export int hasam, hasxn;
+mod_export int hasam, hasxn, hasye;
/* Value of the Co (max_colors) entry: may not be set */
@@ -699,6 +699,7 @@ init_term(void)
/* check whether terminal has automargin (wraparound) capability */
hasam = tgetflag("am");
hasxn = tgetflag("xn"); /* also check for newline wraparound glitch */
+ hasye = tgetflag("YE"); /* print in last column does carriage return */
tclines = tgetnum("li");
tccolumns = tgetnum("co");
@@ -748,6 +749,9 @@ init_term(void)
tcstr[TCCLEARSCREEN] = ztrdup("\14");
tclen[TCCLEARSCREEN] = 1;
}
+#if 0 /* This might work, but there may be more to it */
+ rprompt_indent = (hasye || !tccan(TCLEFT)) ? 1 : 0;
+#endif
}
return 1;
}
@@ -999,6 +1003,15 @@ setupvals(void)
setiparam("COLUMNS", zterm_columns);
setiparam("LINES", zterm_lines);
#endif
+ {
+ /* Import from environment, overrides init_term() */
+ struct value vbuf;
+ char *name = "ZLE_RPROMPT_INDENT";
+ if (getvalue(&vbuf, &name, 1) && !(vbuf.flags & PM_UNSET))
+ rprompt_indent = getintvalue(&vbuf);
+ else
+ rprompt_indent = 1;
+ }
#ifdef HAVE_GETRLIMIT
for (i = 0; i != RLIM_NLIMITS; i++) {
diff --git a/Src/params.c b/Src/params.c
index d6711e4fa..26ad6b221 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -97,6 +97,7 @@ zlong lastval, /* $? */
lastpid, /* $! */
zterm_columns, /* $COLUMNS */
zterm_lines, /* $LINES */
+ rprompt_indent, /* $ZLE_RPROMPT_INDENT */
ppid, /* $PPID */
zsh_subshell; /* $ZSH_SUBSHELL */
/**/
@@ -316,8 +317,10 @@ IPDEF4("PPID", &ppid),
IPDEF4("ZSH_SUBSHELL", &zsh_subshell),
#define IPDEF5(A,B,F) {{NULL,A,PM_INTEGER|PM_SPECIAL},BR((void *)B),GSU(F),10,0,NULL,NULL,NULL,0}
+#define IPDEF5U(A,B,F) {{NULL,A,PM_INTEGER|PM_SPECIAL|PM_UNSET},BR((void *)B),GSU(F),10,0,NULL,NULL,NULL,0}
IPDEF5("COLUMNS", &zterm_columns, zlevar_gsu),
IPDEF5("LINES", &zterm_lines, zlevar_gsu),
+IPDEF5U("ZLE_RPROMPT_INDENT", &rprompt_indent, zlevar_gsu),
IPDEF5("OPTIND", &zoptind, varinteger_gsu),
IPDEF5("SHLVL", &shlvl, varinteger_gsu),
IPDEF5("TRY_BLOCK_ERROR", &try_errflag, varinteger_gsu),
diff --git a/Src/pattern.c b/Src/pattern.c
index a7ef12573..b79c3b444 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -1265,12 +1265,18 @@ patcomppiece(int *flagp, int paren)
* the character following is an end-of-segment character. Thus
* tildes are not special if there is nothing following to
* be excluded.
+ *
+ * Don't look for X()-style kshglobs at this point; we've
+ * checked above for the case with parentheses and we don't
+ * want to match without parentheses.
*/
- if (kshchar || (memchr(zpc_special, *patparse, ZPC_COUNT) &&
- (*patparse != zpc_special[ZPC_TILDE] ||
- patparse[1] == '/' ||
- !memchr(zpc_special, patparse[1], ZPC_SEG_COUNT))))
+ if (kshchar ||
+ (memchr(zpc_special, *patparse, ZPC_NO_KSH_GLOB) &&
+ (*patparse != zpc_special[ZPC_TILDE] ||
+ patparse[1] == '/' ||
+ !memchr(zpc_special, patparse[1], ZPC_SEG_COUNT)))) {
break;
+ }
}
/* Remember the previous character for backtracking */
diff --git a/Src/zsh.h b/Src/zsh.h
index a935d23ad..c86d2a62c 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1417,7 +1417,11 @@ enum zpc_chars {
ZPC_HAT, /* ^ for exclusion (extended glob) */
ZPC_HASH, /* # for repetition (extended glob) */
ZPC_BNULLKEEP, /* Special backslashed null not removed */
- ZPC_KSH_QUEST, /* ? for ?(...) in KSH_GLOB */
+ /*
+ * These characters are only valid before a parenthesis
+ */
+ ZPC_NO_KSH_GLOB,
+ ZPC_KSH_QUEST = ZPC_NO_KSH_GLOB, /* ? for ?(...) in KSH_GLOB */
ZPC_KSH_STAR, /* * for *(...) in KSH_GLOB */
ZPC_KSH_PLUS, /* + for +(...) in KSH_GLOB */
ZPC_KSH_BANG, /* ! for !(...) in KSH_GLOB */
diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index 81b002120..1f8f65286 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -499,3 +499,30 @@
)
0:No error with empty null glob with (N).
>
+
+ (setopt kshglob
+ test_array=(
+ '+fours' '+*'
+ '@titude' '@*'
+ '!bang' '!*'
+ # and check they work in the real kshglob cases too...
+ '+bus+bus' '+(+bus|-car)'
+ '@sinhats' '@(@sinhats|wrensinfens)'
+ '!kerror' '!(!somethingelse)'
+ # and these don't match, to be sure
+ '+more' '+(+less)'
+ '@all@all' '@(@all)'
+ '!goesitall' '!(!goesitall)'
+ )
+ for str pat in $test_array; do
+ eval "[[ $str = $pat ]]" && print "$str matches $pat"
+ done
+ true
+ )
+0:kshglob option does not break +, @, ! without following open parenthesis
+>+fours matches +*
+>@titude matches @*
+>!bang matches !*
+>+bus+bus matches +(+bus|-car)
+>@sinhats matches @(@sinhats|wrensinfens)
+>!kerror matches !(!somethingelse)
diff --git a/Test/comptest b/Test/comptest
index 5577209da..10814d635 100644
--- a/Test/comptest
+++ b/Test/comptest
@@ -34,8 +34,8 @@ comptestinit () {
"fpath=( $fpath )" \
"bindkey -$comptest_keymap" \
'LISTMAX=10000000
+stty 38400 columns 80 rows 24
TERM=vt100
-stty columns 80 rows 24
setopt zle
autoload -U compinit
compinit -u