mirror of
https://github.com/tumillanino/miasma-os.git
synced 2026-04-11 07:15:31 +00:00
move to new repo
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
setopt localoptions extendedglob clobber NO_aliases localloops pipefail NO_shortloops NO_unset
|
||||
zmodload zsh/param/private
|
||||
autoload -Uz zmathfunc && zmathfunc
|
||||
builtin autoload -UWz $PWD/{Completions,Functions}/**/[_.]autocomplete(__|:)*~*.zwc(DN-.:P)
|
||||
typeset -gA compstate=() _lastcomp=()
|
||||
typeset -ga compargs=() comppostfuncs=() comptags=()
|
||||
typeset -g WIDGET= WIDGETSTYLE= context= curcontext=
|
||||
@@ -0,0 +1,30 @@
|
||||
Setup:
|
||||
```zsh
|
||||
% source Tests/__init__.zsh
|
||||
% autocomplete:_main_complete:new() {}
|
||||
%
|
||||
```
|
||||
|
||||
`menu-` widgets should not keep a partial list.
|
||||
```zsh
|
||||
% compstate[old_list]=yes
|
||||
% typeset -g _autocomplete__partial_list
|
||||
% WIDGETSTYLE=menu-complete
|
||||
% _autocomplete__should_insert_unambiguous() { false }
|
||||
% .autocomplete__complete-word__completion-widget
|
||||
% print -r -- $compstate[old_list]
|
||||
|
||||
%
|
||||
```
|
||||
|
||||
You cannot insert unambiguous using only an old list.
|
||||
```zsh
|
||||
% compstate[old_list]=yes
|
||||
% unset _autocomplete__partial_list
|
||||
% _lastcomp[unambiguous]=foo
|
||||
% _autocomplete__should_insert_unambiguous() { true }
|
||||
% .autocomplete__complete-word__completion-widget
|
||||
% print -r -- $compstate[old_list]
|
||||
|
||||
%
|
||||
```
|
||||
@@ -0,0 +1,95 @@
|
||||
Setup:
|
||||
```zsh
|
||||
% source Tests/__init__.zsh
|
||||
%
|
||||
```
|
||||
|
||||
Default completion widget inserts first match.
|
||||
```zsh
|
||||
% compstate[old_list]=keep
|
||||
% _lastcomp[nmatches]=2
|
||||
% .autocomplete__complete-word__post
|
||||
% print -r -- ${(q+)compstate[insert]}
|
||||
1
|
||||
%
|
||||
```
|
||||
|
||||
`menu-` widgets should cycle between completions.
|
||||
```zsh
|
||||
% WIDGETSTYLE=menu-complete
|
||||
% .autocomplete__complete-word__post
|
||||
% print -r -- ${(q+)compstate[insert]} $+MENUSELECT $MENUMODE
|
||||
menu:1 0
|
||||
%
|
||||
```
|
||||
|
||||
`menu-select` widgets should enter the menu.
|
||||
```zsh
|
||||
% WIDGETSTYLE=menu-select
|
||||
% .autocomplete__complete-word__post
|
||||
% print -r -- ${(q+)compstate[insert]} $+MENUSELECT $MENUMODE
|
||||
menu:1 1
|
||||
%
|
||||
```
|
||||
|
||||
`menu-select` widgets with `search` in the name should start a full-text search.
|
||||
```zsh
|
||||
% WIDGET=incremental-history-search-forward
|
||||
% .autocomplete__complete-word__post
|
||||
% print -r -- ${(q+)compstate[insert]} $+MENUSELECT $MENUMODE
|
||||
menu:1 1 search-forward
|
||||
%
|
||||
```
|
||||
|
||||
`reverse-menu-complete` widgets should select the last match.
|
||||
```zsh
|
||||
% WIDGETSTYLE=reverse-menu-complete
|
||||
% .autocomplete__complete-word__post
|
||||
% print -r -- ${(q+)compstate[insert]}
|
||||
menu:0
|
||||
% WIDGETSTYLE=
|
||||
%
|
||||
```
|
||||
|
||||
Widgets with `reverse` in the name should do so, too.
|
||||
```zsh
|
||||
% WIDGET=reverse-complete
|
||||
% .autocomplete__complete-word__post
|
||||
% print -r -- ${(q+)compstate[insert]}
|
||||
0
|
||||
% WIDGET=
|
||||
%
|
||||
```
|
||||
|
||||
Widgets can be configured to inset `unambiguous` instead.
|
||||
```zsh
|
||||
% zstyle ':autocomplete:*' insert-unambiguous yes
|
||||
% compstate[old_list]=
|
||||
% compstate[nmatches]=2
|
||||
% compstate[unambiguous]=foo
|
||||
% .autocomplete__complete-word__post
|
||||
% print -r -- ${(q+)compstate[insert]} $+MENUSELECT $MENUMODE
|
||||
unambiguous 0
|
||||
%
|
||||
```
|
||||
|
||||
Menu widgets should prefix `unambiguous` with `automenu-`.
|
||||
```zsh
|
||||
% WIDGETSTYLE=menu-select
|
||||
% .autocomplete__complete-word__post
|
||||
% print -r -- ${(q+)compstate[insert]} $+MENUSELECT $MENUMODE
|
||||
automenu-unambiguous 0
|
||||
% compstate[unambiguous]=
|
||||
% WIDGETSTYLE=
|
||||
%
|
||||
```
|
||||
|
||||
Certain completions should be suffixed with a space.
|
||||
```zsh
|
||||
% zstyle ':autocomplete:*' add-space foo bar
|
||||
% _comp_tags='foo bar'
|
||||
% .autocomplete__complete-word__post
|
||||
% print -r -- ${(q+)compstate[insert]}
|
||||
'1 '
|
||||
%
|
||||
```
|
||||
Reference in New Issue
Block a user