mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-03 22:32:12 +02:00
m0viefreak: users/18655,18657,18660: assorted auto-removable suffix fixes
Src/Zle/compresult.c, Src/Zle/zle_misc.c, Src/Zle/zle_refresh.c: fix auto-removable suffix highlighting Completion/Unix/Command/_git: fix compadd for auto-removable suffix in _git_commit_ranges and _git_stash
This commit is contained in:
parent
ab917d4a0e
commit
cd2eb07a78
5 changed files with 31 additions and 19 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2014-03-23 Barton E. Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
|
* m0viefreak: users/18660: Src/Zle/compresult.c,
|
||||||
|
Src/Zle/zle_misc.c, Src/Zle/zle_refresh.c: fix auto-removable
|
||||||
|
suffix highlighting
|
||||||
|
|
||||||
|
* m0viefreak: users/18657: Completion/Unix/Command/_git: fix
|
||||||
|
compadd for auto-removable suffix in _git_stash
|
||||||
|
|
||||||
|
* m0viefreak: users/18655: Completion/Unix/Command/_git: fix
|
||||||
|
compadd for auto-removable suffix in _git_commit_ranges
|
||||||
|
|
||||||
2014-03-21 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
2014-03-21 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||||
|
|
||||||
* Takeshi Banse: 32502: Completion/Unix/Command/_git: fix typo
|
* Takeshi Banse: 32502: Completion/Unix/Command/_git: fix typo
|
||||||
|
|
|
@ -1536,7 +1536,7 @@ _git-stash () {
|
||||||
'(--keep-index )--no-keep-index[all changes already added to the index are undone]' \
|
'(--keep-index )--no-keep-index[all changes already added to the index are undone]' \
|
||||||
'(-q --quiet)'{-q,--quiet}'[suppress all output]' \
|
'(-q --quiet)'{-q,--quiet}'[suppress all output]' \
|
||||||
'(-u --include-untracked)'{-u,--include-untracked}'[include untracked files]' \
|
'(-u --include-untracked)'{-u,--include-untracked}'[include untracked files]' \
|
||||||
'::message' && ret=0
|
':: :_guard "([^-]?#|)" message' && ret=0
|
||||||
;;
|
;;
|
||||||
(list)
|
(list)
|
||||||
local -a log_options revision_options
|
local -a log_options revision_options
|
||||||
|
@ -5602,7 +5602,7 @@ __git_commit_ranges () {
|
||||||
if compset -P '*..(.|)'; then
|
if compset -P '*..(.|)'; then
|
||||||
__git_commits $*
|
__git_commits $*
|
||||||
else
|
else
|
||||||
compset -S '..*' || suf=( -qS .. -r '.@~ ^:' )
|
compset -S '..*' || suf=( -S .. -r '.@~ ^:\t\n\-' )
|
||||||
__git_commits $* $suf
|
__git_commits $* $suf
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -1131,7 +1131,7 @@ do_single(Cmatch m)
|
||||||
/* If a suffix was added, and is removable, let *
|
/* If a suffix was added, and is removable, let *
|
||||||
* `,' and `}' remove it. */
|
* `,' and `}' remove it. */
|
||||||
if (isset(AUTOPARAMKEYS))
|
if (isset(AUTOPARAMKEYS))
|
||||||
addsuffix(SUFTYP_POSSTR, 0, ZWS(",}"), 2, suffixnoinslen);
|
addsuffix(SUFTYP_POSSTR, 0, ZWS(",}"), 2, suffixlen);
|
||||||
} else if (!menucmp) {
|
} else if (!menucmp) {
|
||||||
/*{{*/
|
/*{{*/
|
||||||
/* Otherwise, add a `,' suffix, and let `}' remove it. */
|
/* Otherwise, add a `,' suffix, and let `}' remove it. */
|
||||||
|
|
|
@ -1249,10 +1249,14 @@ static char *suffixfunc;
|
||||||
/* Length associated with the suffix function */
|
/* Length associated with the suffix function */
|
||||||
static int suffixfunclen;
|
static int suffixfunclen;
|
||||||
|
|
||||||
/* Length associated with uninsertable characters */
|
/* Whether to remove suffix on uninsertable characters */
|
||||||
|
/**/
|
||||||
|
int suffixnoinsrem;
|
||||||
|
|
||||||
|
/* Length of the currently active, auto-removable suffix. */
|
||||||
/**/
|
/**/
|
||||||
mod_export int
|
mod_export int
|
||||||
suffixnoinslen;
|
suffixlen;
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
mod_export void
|
mod_export void
|
||||||
|
@ -1309,7 +1313,8 @@ makesuffix(int n)
|
||||||
if ((suffixchars = getsparam("ZLE_SPACE_SUFFIX_CHARS")) && *suffixchars)
|
if ((suffixchars = getsparam("ZLE_SPACE_SUFFIX_CHARS")) && *suffixchars)
|
||||||
addsuffixstring(SUFTYP_POSSTR, SUFFLAGS_SPACE, suffixchars, n);
|
addsuffixstring(SUFTYP_POSSTR, SUFFLAGS_SPACE, suffixchars, n);
|
||||||
|
|
||||||
suffixnoinslen = n;
|
suffixlen = n;
|
||||||
|
suffixnoinsrem = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up suffix for parameter names: the last n characters are a suffix *
|
/* Set up suffix for parameter names: the last n characters are a suffix *
|
||||||
|
@ -1358,15 +1363,10 @@ makesuffixstr(char *f, char *s, int n)
|
||||||
s = metafy(s, i, META_USEHEAP);
|
s = metafy(s, i, META_USEHEAP);
|
||||||
ws = stringaszleline(s, 0, &i, NULL, NULL);
|
ws = stringaszleline(s, 0, &i, NULL, NULL);
|
||||||
|
|
||||||
if (z)
|
/* Remove suffix on uninsertable characters if \- was given *
|
||||||
suffixnoinslen = inv ? 0 : n;
|
* and the character class wasn't negated -- or vice versa. */
|
||||||
else if (inv) {
|
suffixnoinsrem = z ^ inv;
|
||||||
/*
|
suffixlen = n;
|
||||||
* negative match, \- wasn't present, so it *should*
|
|
||||||
* have this suffix length
|
|
||||||
*/
|
|
||||||
suffixnoinslen = n;
|
|
||||||
}
|
|
||||||
|
|
||||||
lasts = wptr = ws;
|
lasts = wptr = ws;
|
||||||
while (i) {
|
while (i) {
|
||||||
|
@ -1444,7 +1444,7 @@ iremovesuffix(ZLE_INT_T c, int keep)
|
||||||
struct suffixset *ss;
|
struct suffixset *ss;
|
||||||
|
|
||||||
if (c == NO_INSERT_CHAR) {
|
if (c == NO_INSERT_CHAR) {
|
||||||
sl = suffixnoinslen;
|
sl = suffixnoinsrem ? suffixlen : 0;
|
||||||
} else {
|
} else {
|
||||||
ZLE_CHAR_T ch = c;
|
ZLE_CHAR_T ch = c;
|
||||||
/*
|
/*
|
||||||
|
@ -1538,5 +1538,5 @@ fixsuffix(void)
|
||||||
suffixlist = next;
|
suffixlist = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
suffixfunclen = suffixnoinslen = 0;
|
suffixfunclen = suffixnoinsrem = suffixlen = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1046,8 +1046,8 @@ zrefresh(void)
|
||||||
region_highlights[1].start = region_highlights[1].end = -1;
|
region_highlights[1].start = region_highlights[1].end = -1;
|
||||||
}
|
}
|
||||||
/* check for an active completion suffix */
|
/* check for an active completion suffix */
|
||||||
if (suffixnoinslen) {
|
if (suffixlen) {
|
||||||
region_highlights[2].start = zlecs - suffixnoinslen;
|
region_highlights[2].start = zlecs - suffixlen;
|
||||||
region_highlights[2].end = zlecs;
|
region_highlights[2].end = zlecs;
|
||||||
} else {
|
} else {
|
||||||
region_highlights[2].start = region_highlights[2].end = -1;
|
region_highlights[2].start = region_highlights[2].end = -1;
|
||||||
|
|
Loading…
Reference in a new issue