mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-09-21 19:31:50 +02:00
Mikael: 27453: highlighting for removable completion suffixes
27466: document it
This commit is contained in:
parent
2fc15d198a
commit
7bc089c6be
@ -1,6 +1,11 @@
|
||||
2009-12-05 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* frank: 27450: b/Completion/Unix/Command/_tmux: another
|
||||
* 27466: Doc/Zsh/zle.yo: document 27453.
|
||||
|
||||
* Mikael: 27453: Src/Zle/zle_refresh.c: highlighting
|
||||
of removable completions suffixes.
|
||||
|
||||
* Frank: 27450: b/Completion/Unix/Command/_tmux: another
|
||||
update.
|
||||
|
||||
2009-12-05 Clint Adams <clint@zsh.org>
|
||||
@ -12446,5 +12451,5 @@
|
||||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.4834 $
|
||||
* $Revision: 1.4835 $
|
||||
*****************************************************
|
||||
|
@ -2163,6 +2163,17 @@ Individual characters that have no direct printable
|
||||
representation but are shown in a special manner by the line editor.
|
||||
These characters are described below.
|
||||
)
|
||||
cindex(completion removable suffix, highlighting)
|
||||
cindex(suffix, highlighting removable, in completion)
|
||||
cindex(removable suffix, highlighting in completino)
|
||||
item(tt(suffix))(
|
||||
This context is used in completion for characters that are
|
||||
marked as suffixes that will be removed if the completion ends
|
||||
at that point, the most obvious example being a slash (tt(/)) after
|
||||
a directory name. Note that suffix removal is configurable; the
|
||||
circumstances under which the suffix will be removed may differ
|
||||
for different completions.
|
||||
)
|
||||
enditem()
|
||||
|
||||
tt(zle_highlight) may contain additional fields for controlling how
|
||||
@ -2235,6 +2246,7 @@ not usually affected by the bold attribute.
|
||||
)
|
||||
item(tt(bold))(
|
||||
The characters in the given context are shown in a bold font.
|
||||
Not all terminals distinguish bold fonts.
|
||||
)
|
||||
item(tt(standout))(
|
||||
The characters in the given context are shown in the terminal's standout
|
||||
@ -2280,7 +2292,7 @@ If tt(zle_highlight) is not set or no value applies to a particular
|
||||
context, the defaults applied are equivalent to
|
||||
|
||||
example(zle_highlight=LPAR()region:standout special:standout
|
||||
isearch:underline+RPAR())
|
||||
suffix:bold isearch:underline+RPAR())
|
||||
|
||||
i.e. both the region and special characters are shown in standout mode.
|
||||
|
||||
|
@ -247,8 +247,9 @@ struct region_highlight *region_highlights;
|
||||
* for the first few elements of region_highlights.
|
||||
* 0: region between point and mark
|
||||
* 1: isearch region
|
||||
* 2: suffix
|
||||
*/
|
||||
#define N_SPECIAL_HIGHLIGHTS (2)
|
||||
#define N_SPECIAL_HIGHLIGHTS (3)
|
||||
/*
|
||||
* Number of elements in region_highlights.
|
||||
* This includes the special elements above.
|
||||
@ -340,6 +341,7 @@ zle_set_highlight(void)
|
||||
int special_atr_on_set = 0;
|
||||
int region_atr_on_set = 0;
|
||||
int isearch_atr_on_set = 0;
|
||||
int suffix_atr_on_set = 0;
|
||||
struct region_highlight *rhp;
|
||||
|
||||
special_atr_on = default_atr_on = 0;
|
||||
@ -373,6 +375,9 @@ zle_set_highlight(void)
|
||||
} else if (strpfx("isearch:", *atrs)) {
|
||||
match_highlight(*atrs + 8, &(region_highlights[1].atr));
|
||||
isearch_atr_on_set = 1;
|
||||
} else if (strpfx("suffix:", *atrs)) {
|
||||
match_highlight(*atrs + 7, &(region_highlights[2].atr));
|
||||
suffix_atr_on_set = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -384,6 +389,8 @@ zle_set_highlight(void)
|
||||
region_highlights->atr = TXTSTANDOUT;
|
||||
if (!isearch_atr_on_set)
|
||||
region_highlights[1].atr = TXTUNDERLINE;
|
||||
if (!suffix_atr_on_set)
|
||||
region_highlights[2].atr = TXTBOLDFACE;
|
||||
|
||||
allocate_colour_buffer();
|
||||
}
|
||||
@ -1060,6 +1067,13 @@ zrefresh(void)
|
||||
} else {
|
||||
region_highlights[1].start = region_highlights[1].end = -1;
|
||||
}
|
||||
/* check for an active completion suffix */
|
||||
if (suffixnoinslen) {
|
||||
region_highlights[2].start = zlecs - suffixnoinslen;
|
||||
region_highlights[2].end = zlecs;
|
||||
} else {
|
||||
region_highlights[2].start = region_highlights[2].end = -1;
|
||||
}
|
||||
|
||||
if (clearlist && listshown > 0) {
|
||||
if (tccan(TCCLEAREOD)) {
|
||||
|
Loading…
Reference in New Issue
Block a user