mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-01 20:52:06 -07:00
Compare commits
26 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9f30ca2923 | ||
|
37f2d8f795 | ||
|
400e443a0a | ||
|
0a8d2996dc | ||
|
cfdb00b971 | ||
|
9b9ad39143 | ||
|
0541c0dbcf | ||
|
47b11cb8b4 | ||
|
d3da310b92 | ||
|
93e0a6a9de | ||
|
ac549a853a | ||
|
053af9a1c8 | ||
|
60112def02 | ||
|
2134c0c8a9 | ||
|
3222d62ddf | ||
|
aeb957a285 | ||
|
154cf22ffa | ||
|
51f532697e | ||
|
01b88539ba | ||
|
3066b206af | ||
|
04492bab10 | ||
|
8b0d0342d4 | ||
|
957c12e7d7 | ||
|
3b5ae0f8a2 | ||
|
1fc5659842 | ||
|
1acd2adce2 |
25
CHANGELOG.md
25
CHANGELOG.md
@@ -1,6 +1,31 @@
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
0.15.5
|
||||||
|
------
|
||||||
|
- Setting foreground color will no longer set background color to black
|
||||||
|
- e.g. `fzf --color fg:153`
|
||||||
|
- `--tiebreak=end` will consider relative position instead of absolute distance
|
||||||
|
- Updated `fzf#wrap` function to respect `g:fzf_colors`
|
||||||
|
|
||||||
|
0.15.4
|
||||||
|
------
|
||||||
|
- Added support for range expression in preview and execute action
|
||||||
|
- e.g. `ls -l | fzf --preview="echo user={3} when={-4..-2}; cat {-1}" --header-lines=1`
|
||||||
|
- `{q}` will be replaced to the single-quoted string of the current query
|
||||||
|
- Fixed to properly handle unicode whitespace characters
|
||||||
|
- Display scroll indicator in preview window
|
||||||
|
- Inverse search term will use exact matcher by default
|
||||||
|
- This is a breaking change, but I believe it makes much more sense. It is
|
||||||
|
almost impossible to predict which entries will be filtered out due to
|
||||||
|
a fuzzy inverse term. You can still perform inverse-fuzzy-match by
|
||||||
|
prepending `!'` to the term.
|
||||||
|
|
||||||
|
0.15.3
|
||||||
|
------
|
||||||
|
- Added support for more ANSI attributes: dim, underline, blink, and reverse
|
||||||
|
- Fixed race condition in `toggle-preview`
|
||||||
|
|
||||||
0.15.2
|
0.15.2
|
||||||
------
|
------
|
||||||
- Preview window is now scrollable
|
- Preview window is now scrollable
|
||||||
|
25
README.md
25
README.md
@@ -113,16 +113,16 @@ vim $(fzf)
|
|||||||
|
|
||||||
Unless otherwise specified, fzf starts in "extended-search mode" where you can
|
Unless otherwise specified, fzf starts in "extended-search mode" where you can
|
||||||
type in multiple search terms delimited by spaces. e.g. `^music .mp3$ sbtrkt
|
type in multiple search terms delimited by spaces. e.g. `^music .mp3$ sbtrkt
|
||||||
!rmx`
|
!fire`
|
||||||
|
|
||||||
| Token | Match type | Description |
|
| Token | Match type | Description |
|
||||||
| -------- | -------------------- | -------------------------------- |
|
| -------- | -------------------------- | --------------------------------- |
|
||||||
| `sbtrkt` | fuzzy-match | Items that match `sbtrkt` |
|
| `sbtrkt` | fuzzy-match | Items that match `sbtrkt` |
|
||||||
| `^music` | prefix-exact-match | Items that start with `music` |
|
| `^music` | prefix-exact-match | Items that start with `music` |
|
||||||
| `.mp3$` | suffix-exact-match | Items that end with `.mp3` |
|
| `.mp3$` | suffix-exact-match | Items that end with `.mp3` |
|
||||||
| `'wild` | exact-match (quoted) | Items that include `wild` |
|
| `'wild` | exact-match (quoted) | Items that include `wild` |
|
||||||
| `!rmx` | inverse-fuzzy-match | Items that do not match `rmx` |
|
| `!fire` | inverse-exact-match | Items that do not include `fire` |
|
||||||
| `!'fire` | inverse-exact-match | Items that do not include `fire` |
|
| `!.mp3$` | inverse-suffix-exact-match | Items that do not end with `.mp3` |
|
||||||
|
|
||||||
If you don't prefer fuzzy matching and do not wish to "quote" every word,
|
If you don't prefer fuzzy matching and do not wish to "quote" every word,
|
||||||
start fzf with `-e` or `--exact` option. Note that when `--exact` is set,
|
start fzf with `-e` or `--exact` option. Note that when `--exact` is set,
|
||||||
@@ -305,7 +305,7 @@ If you have set up fzf for Vim, `:FZF` command will be added.
|
|||||||
:FZF ~
|
:FZF ~
|
||||||
|
|
||||||
" With options
|
" With options
|
||||||
:FZF --no-sort -m /tmp
|
:FZF --no-sort --reverse --inline-info /tmp
|
||||||
|
|
||||||
" Bang version starts in fullscreen instead of using tmux pane or Neovim split
|
" Bang version starts in fullscreen instead of using tmux pane or Neovim split
|
||||||
:FZF!
|
:FZF!
|
||||||
@@ -319,7 +319,7 @@ Note that the environment variables `FZF_DEFAULT_COMMAND` and
|
|||||||
`FZF_DEFAULT_OPTS` also apply here. Refer to [the wiki page][fzf-config] for
|
`FZF_DEFAULT_OPTS` also apply here. Refer to [the wiki page][fzf-config] for
|
||||||
customization.
|
customization.
|
||||||
|
|
||||||
[fzf-config]: https://github.com/junegunn/fzf/wiki/Configuring-FZF-command-(vim)
|
[fzf-config]: https://github.com/junegunn/fzf/wiki/Configuring-Vim-plugin
|
||||||
|
|
||||||
#### `fzf#run`
|
#### `fzf#run`
|
||||||
|
|
||||||
@@ -347,7 +347,8 @@ page](https://github.com/junegunn/fzf/wiki/Examples-(vim)).
|
|||||||
|
|
||||||
`fzf#wrap([name string,] [opts dict,] [fullscreen boolean])` is a helper
|
`fzf#wrap([name string,] [opts dict,] [fullscreen boolean])` is a helper
|
||||||
function that decorates the options dictionary so that it understands
|
function that decorates the options dictionary so that it understands
|
||||||
`g:fzf_layout`, `g:fzf_action`, and `g:fzf_history_dir` like `:FZF`.
|
`g:fzf_layout`, `g:fzf_action`, `g:fzf_colors`, and `g:fzf_history_dir` like
|
||||||
|
`:FZF`.
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
command! -bang MyStuff
|
command! -bang MyStuff
|
||||||
|
@@ -17,6 +17,7 @@ swap=""
|
|||||||
close=""
|
close=""
|
||||||
term=""
|
term=""
|
||||||
[[ -n "$LINES" ]] && lines=$LINES || lines=$(tput lines)
|
[[ -n "$LINES" ]] && lines=$LINES || lines=$(tput lines)
|
||||||
|
[[ -n "$COLUMNS" ]] && columns=$COLUMNS || columns=$(tput cols)
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
>&2 echo 'usage: fzf-tmux [-u|-d [HEIGHT[%]]] [-l|-r [WIDTH[%]]] [--] [FZF OPTIONS]
|
>&2 echo 'usage: fzf-tmux [-u|-d [HEIGHT[%]]] [-l|-r [WIDTH[%]]] [--] [FZF OPTIONS]
|
||||||
@@ -83,7 +84,7 @@ while [[ $# -gt 0 ]]; do
|
|||||||
else
|
else
|
||||||
if [[ -n "$swap" ]]; then
|
if [[ -n "$swap" ]]; then
|
||||||
if [[ "$arg" =~ ^.l ]]; then
|
if [[ "$arg" =~ ^.l ]]; then
|
||||||
[[ -n "$COLUMNS" ]] && max=$COLUMNS || max=$(tput cols)
|
max=$columns
|
||||||
else
|
else
|
||||||
max=$lines
|
max=$lines
|
||||||
fi
|
fi
|
||||||
@@ -108,7 +109,7 @@ while [[ $# -gt 0 ]]; do
|
|||||||
[[ -n "$skip" ]] && args+=("$arg")
|
[[ -n "$skip" ]] && args+=("$arg")
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -z "$TMUX" ]] || [[ "$lines" -le 15 ]]; then
|
if [[ -z "$TMUX" || "$opt" =~ ^-h && "$columns" -le 40 || ! "$opt" =~ ^-h && "$lines" -le 15 ]]; then
|
||||||
"$fzf" "${args[@]}"
|
"$fzf" "${args[@]}"
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
4
install
4
install
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
[[ "$@" =~ --pre ]] && version=0.15.2 pre=1 ||
|
[[ "$@" =~ --pre ]] && version=0.15.5 pre=1 ||
|
||||||
version=0.15.2 pre=0
|
version=0.15.5 pre=0
|
||||||
|
|
||||||
auto_completion=
|
auto_completion=
|
||||||
key_bindings=
|
key_bindings=
|
||||||
|
@@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
..
|
..
|
||||||
.TH fzf-tmux 1 "Sep 2016" "fzf 0.15.2" "fzf-tmux - open fzf in tmux split pane"
|
.TH fzf-tmux 1 "Oct 2016" "fzf 0.15.5" "fzf-tmux - open fzf in tmux split pane"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
fzf-tmux - open fzf in tmux split pane
|
fzf-tmux - open fzf in tmux split pane
|
||||||
|
@@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
..
|
..
|
||||||
.TH fzf 1 "Sep 2016" "fzf 0.15.2" "fzf - a command-line fuzzy finder"
|
.TH fzf 1 "Oct 2016" "fzf 0.15.5" "fzf - a command-line fuzzy finder"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
fzf - a command-line fuzzy finder
|
fzf - a command-line fuzzy finder
|
||||||
@@ -232,11 +232,17 @@ automatically truncated when the number of the lines exceeds the value.
|
|||||||
.TP
|
.TP
|
||||||
.BI "--preview=" "COMMAND"
|
.BI "--preview=" "COMMAND"
|
||||||
Execute the given command for the current line and display the result on the
|
Execute the given command for the current line and display the result on the
|
||||||
preview window. \fB{}\fR is the placeholder for the quoted string of the
|
preview window. \fB{}\fR in the command is the placeholder that is replaced to
|
||||||
current line.
|
the single-quoted string of the current line. To transform the replacement
|
||||||
|
string, specify field index expressions between the braces (See \fBFIELD INDEX
|
||||||
|
EXPRESSION\fR for the details). Also, \fB{q}\fR is replaced to the current
|
||||||
|
query string.
|
||||||
|
|
||||||
.RS
|
.RS
|
||||||
e.g. \fBfzf --preview="head -$LINES {}"\fR
|
e.g. \fBfzf --preview="head -$LINES {}"\fR
|
||||||
|
\fBls -l | fzf --preview="echo user={3} when={-4..-2}; cat {-1}" --header-lines=1\fR
|
||||||
|
|
||||||
|
Note that you can escape a placeholder pattern by prepending a backslash.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.BI "--preview-window=" "[POSITION][:SIZE[%]][:hidden]"
|
.BI "--preview-window=" "[POSITION][:SIZE[%]][:hidden]"
|
||||||
@@ -358,7 +364,7 @@ with the given string. An anchored-match term is also an exact-match term.
|
|||||||
|
|
||||||
.SS Negation
|
.SS Negation
|
||||||
If a term is prefixed by \fB!\fR, fzf will exclude the lines that satisfy the
|
If a term is prefixed by \fB!\fR, fzf will exclude the lines that satisfy the
|
||||||
term from the result.
|
term from the result. In this case, fzf performs exact match by default.
|
||||||
|
|
||||||
.SS Exact-match by default
|
.SS Exact-match by default
|
||||||
If you don't prefer fuzzy matching and do not wish to "quote" (prefixing with
|
If you don't prefer fuzzy matching and do not wish to "quote" (prefixing with
|
||||||
@@ -434,6 +440,10 @@ e.g. \fBfzf --bind=ctrl-j:accept,ctrl-k:kill-line\fR
|
|||||||
\fBnext-history\fR (\fIctrl-n\fR on \fB--history\fR)
|
\fBnext-history\fR (\fIctrl-n\fR on \fB--history\fR)
|
||||||
\fBpage-down\fR \fIpgdn\fR
|
\fBpage-down\fR \fIpgdn\fR
|
||||||
\fBpage-up\fR \fIpgup\fR
|
\fBpage-up\fR \fIpgup\fR
|
||||||
|
\fBpreview-down\fR
|
||||||
|
\fBpreview-up\fR
|
||||||
|
\fBpreview-page-down\fR
|
||||||
|
\fBpreview-page-up\fR
|
||||||
\fBprevious-history\fR (\fIctrl-p\fR on \fB--history\fR)
|
\fBprevious-history\fR (\fIctrl-p\fR on \fB--history\fR)
|
||||||
\fBprint-query\fR (print query and exit)
|
\fBprint-query\fR (print query and exit)
|
||||||
\fBselect-all\fR
|
\fBselect-all\fR
|
||||||
@@ -456,9 +466,11 @@ binding \fBenter\fR key to \fBless\fR command like follows.
|
|||||||
|
|
||||||
\fBfzf --bind "enter:execute(less {})"\fR
|
\fBfzf --bind "enter:execute(less {})"\fR
|
||||||
|
|
||||||
\fB{}\fR is the placeholder for the quoted string of the current line.
|
You can use the same placeholder expressions as in \fB--preview\fR.
|
||||||
If the command contains parentheses, you can use any of the following
|
|
||||||
alternative notations to avoid parse errors.
|
If the command contains parentheses, fzf may fail to parse the expression. In
|
||||||
|
that case, you can use any of the following alternative notations to avoid
|
||||||
|
parse errors.
|
||||||
|
|
||||||
\fBexecute[...]\fR
|
\fBexecute[...]\fR
|
||||||
\fBexecute~...~\fR
|
\fBexecute~...~\fR
|
||||||
@@ -477,7 +489,7 @@ alternative notations to avoid parse errors.
|
|||||||
.RS
|
.RS
|
||||||
This is the special form that frees you from parse errors as it does not expect
|
This is the special form that frees you from parse errors as it does not expect
|
||||||
the closing character. The catch is that it should be the last one in the
|
the closing character. The catch is that it should be the last one in the
|
||||||
comma-separated list.
|
comma-separated list of key-action pairs.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
\fBexecute-multi(...)\fR is an alternative action that executes the command
|
\fBexecute-multi(...)\fR is an alternative action that executes the command
|
||||||
|
@@ -21,6 +21,11 @@
|
|||||||
" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
if exists('g:loaded_fzf')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_fzf = 1
|
||||||
|
|
||||||
let s:default_layout = { 'down': '~40%' }
|
let s:default_layout = { 'down': '~40%' }
|
||||||
let s:layout_keys = ['window', 'up', 'down', 'left', 'right']
|
let s:layout_keys = ['window', 'up', 'down', 'left', 'right']
|
||||||
let s:fzf_go = expand('<sfile>:h:h').'/bin/fzf'
|
let s:fzf_go = expand('<sfile>:h:h').'/bin/fzf'
|
||||||
@@ -154,6 +159,22 @@ function! s:common_sink(action, lines) abort
|
|||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:get_color(attr, ...)
|
||||||
|
for group in a:000
|
||||||
|
let code = synIDattr(synIDtrans(hlID(group)), a:attr, 'cterm')
|
||||||
|
if code =~ '^[0-9]\+$'
|
||||||
|
return code
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:defaults()
|
||||||
|
let rules = copy(get(g:, 'fzf_colors', {}))
|
||||||
|
let colors = join(map(items(filter(map(rules, 'call("s:get_color", v:val)'), '!empty(v:val)')), 'join(v:val, ":")'), ',')
|
||||||
|
return empty(colors) ? '' : ('--color='.colors)
|
||||||
|
endfunction
|
||||||
|
|
||||||
" [name string,] [opts dict,] [fullscreen boolean]
|
" [name string,] [opts dict,] [fullscreen boolean]
|
||||||
function! fzf#wrap(...)
|
function! fzf#wrap(...)
|
||||||
let args = ['', {}, 0]
|
let args = ['', {}, 0]
|
||||||
@@ -185,8 +206,10 @@ function! fzf#wrap(...)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Colors: g:fzf_colors
|
||||||
|
let opts.options = s:defaults() .' '. get(opts, 'options', '')
|
||||||
|
|
||||||
" History: g:fzf_history_dir
|
" History: g:fzf_history_dir
|
||||||
let opts.options = get(opts, 'options', '')
|
|
||||||
if len(name) && len(get(g:, 'fzf_history_dir', ''))
|
if len(name) && len(get(g:, 'fzf_history_dir', ''))
|
||||||
let dir = expand(g:fzf_history_dir)
|
let dir = expand(g:fzf_history_dir)
|
||||||
if !isdirectory(dir)
|
if !isdirectory(dir)
|
||||||
@@ -289,7 +312,8 @@ function! s:fzf_tmux(dict)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:splittable(dict)
|
function! s:splittable(dict)
|
||||||
return s:present(a:dict, 'up', 'down', 'left', 'right')
|
return s:present(a:dict, 'up', 'down') && &lines > 15 ||
|
||||||
|
\ s:present(a:dict, 'left', 'right') && &columns > 40
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:pushd(dict)
|
function! s:pushd(dict)
|
||||||
@@ -405,24 +429,25 @@ function! s:split(dict)
|
|||||||
\ 'right': ['vertical botright', 'vertical resize', &columns] }
|
\ 'right': ['vertical botright', 'vertical resize', &columns] }
|
||||||
let ppos = s:getpos()
|
let ppos = s:getpos()
|
||||||
try
|
try
|
||||||
for [dir, triple] in items(directions)
|
|
||||||
let val = get(a:dict, dir, '')
|
|
||||||
if !empty(val)
|
|
||||||
let [cmd, resz, max] = triple
|
|
||||||
if (dir == 'up' || dir == 'down') && val[0] == '~'
|
|
||||||
let sz = s:calc_size(max, val, a:dict)
|
|
||||||
else
|
|
||||||
let sz = s:calc_size(max, val, {})
|
|
||||||
endif
|
|
||||||
execute cmd sz.'new'
|
|
||||||
execute resz sz
|
|
||||||
return [ppos, {}]
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
if s:present(a:dict, 'window')
|
if s:present(a:dict, 'window')
|
||||||
execute a:dict.window
|
execute a:dict.window
|
||||||
else
|
elseif !s:splittable(a:dict)
|
||||||
execute (tabpagenr()-1).'tabnew'
|
execute (tabpagenr()-1).'tabnew'
|
||||||
|
else
|
||||||
|
for [dir, triple] in items(directions)
|
||||||
|
let val = get(a:dict, dir, '')
|
||||||
|
if !empty(val)
|
||||||
|
let [cmd, resz, max] = triple
|
||||||
|
if (dir == 'up' || dir == 'down') && val[0] == '~'
|
||||||
|
let sz = s:calc_size(max, val, a:dict)
|
||||||
|
else
|
||||||
|
let sz = s:calc_size(max, val, {})
|
||||||
|
endif
|
||||||
|
execute cmd sz.'new'
|
||||||
|
execute resz sz
|
||||||
|
return [ppos, {}]
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
endif
|
endif
|
||||||
return [ppos, { '&l:wfw': &l:wfw, '&l:wfh': &l:wfh }]
|
return [ppos, { '&l:wfw': &l:wfw, '&l:wfh': &l:wfh }]
|
||||||
finally
|
finally
|
||||||
@@ -558,11 +583,15 @@ let s:default_action = {
|
|||||||
|
|
||||||
function! s:cmd(bang, ...) abort
|
function! s:cmd(bang, ...) abort
|
||||||
let args = copy(a:000)
|
let args = copy(a:000)
|
||||||
let opts = {}
|
let opts = { 'options': '--multi ' }
|
||||||
if len(args) && isdirectory(expand(args[-1]))
|
if len(args) && isdirectory(expand(args[-1]))
|
||||||
let opts.dir = substitute(remove(args, -1), '\\\(["'']\)', '\1', 'g')
|
let opts.dir = substitute(substitute(remove(args, -1), '\\\(["'']\)', '\1', 'g'), '/*$', '/', '')
|
||||||
|
let opts.options .= ' --prompt '.shellescape(opts.dir)
|
||||||
|
else
|
||||||
|
let opts.options .= ' --prompt '.shellescape(pathshorten(getcwd()).'/')
|
||||||
endif
|
endif
|
||||||
call fzf#run(fzf#wrap('FZF', extend({'options': join(args)}, opts), a:bang))
|
let opts.options .= ' '.join(args)
|
||||||
|
call fzf#run(fzf#wrap('FZF', opts, a:bang))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
command! -nargs=* -complete=dir -bang FZF call s:cmd(<bang>0, <f-args>)
|
command! -nargs=* -complete=dir -bang FZF call s:cmd(<bang>0, <f-args>)
|
||||||
|
@@ -44,7 +44,7 @@ __fzf_generic_path_completion() {
|
|||||||
setopt localoptions nonomatch
|
setopt localoptions nonomatch
|
||||||
dir="$base"
|
dir="$base"
|
||||||
while [ 1 ]; do
|
while [ 1 ]; do
|
||||||
if [ -z "$dir" -o -d ${~dir} ]; then
|
if [[ -z "$dir" || -d ${~dir} ]]; then
|
||||||
leftover=${base/#"$dir"}
|
leftover=${base/#"$dir"}
|
||||||
leftover=${leftover/#\/}
|
leftover=${leftover/#\/}
|
||||||
[ -z "$dir" ] && dir='.'
|
[ -z "$dir" ] && dir='.'
|
||||||
@@ -111,7 +111,7 @@ _fzf_complete_telnet() {
|
|||||||
|
|
||||||
_fzf_complete_ssh() {
|
_fzf_complete_ssh() {
|
||||||
_fzf_complete '+m' "$@" < <(
|
_fzf_complete '+m' "$@" < <(
|
||||||
cat <(cat ~/.ssh/config /etc/ssh/ssh_config 2> /dev/null | command grep -i '^host' | command grep -v '*') \
|
command cat <(cat ~/.ssh/config /etc/ssh/ssh_config 2> /dev/null | command grep -i '^host' | command grep -v '*') \
|
||||||
<(command grep -oE '^[^ ]+' ~/.ssh/known_hosts | tr ',' '\n' | awk '{ print $1 " " $1 }') \
|
<(command grep -oE '^[^ ]+' ~/.ssh/known_hosts | tr ',' '\n' | awk '{ print $1 " " $1 }') \
|
||||||
<(command grep -v '^\s*\(#\|$\)' /etc/hosts | command grep -Fv '0.0.0.0') |
|
<(command grep -v '^\s*\(#\|$\)' /etc/hosts | command grep -Fv '0.0.0.0') |
|
||||||
awk '{if (length($2) > 0) {print $2}}' | sort -u
|
awk '{if (length($2) > 0) {print $2}}' | sort -u
|
||||||
|
@@ -26,8 +26,8 @@ function fzf_key_bindings
|
|||||||
end
|
end
|
||||||
|
|
||||||
function fzf-history-widget
|
function fzf-history-widget
|
||||||
history | eval (__fzfcmd) +s +m --tiebreak=index --toggle-sort=ctrl-r $FZF_CTRL_R_OPTS > $TMPDIR/fzf.result
|
history | eval (__fzfcmd) +s +m --tiebreak=index --toggle-sort=ctrl-r $FZF_CTRL_R_OPTS -q '(commandline)' > $TMPDIR/fzf.result
|
||||||
and commandline (cat $TMPDIR/fzf.result)
|
and commandline -- (cat $TMPDIR/fzf.result)
|
||||||
commandline -f repaint
|
commandline -f repaint
|
||||||
rm -f $TMPDIR/fzf.result
|
rm -f $TMPDIR/fzf.result
|
||||||
end
|
end
|
||||||
|
24
src/ansi.go
24
src/ansi.go
@@ -6,6 +6,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
|
"github.com/junegunn/fzf/src/curses"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ansiOffset struct {
|
type ansiOffset struct {
|
||||||
@@ -16,18 +18,18 @@ type ansiOffset struct {
|
|||||||
type ansiState struct {
|
type ansiState struct {
|
||||||
fg int
|
fg int
|
||||||
bg int
|
bg int
|
||||||
bold bool
|
attr curses.Attr
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ansiState) colored() bool {
|
func (s *ansiState) colored() bool {
|
||||||
return s.fg != -1 || s.bg != -1 || s.bold
|
return s.fg != -1 || s.bg != -1 || s.attr > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ansiState) equals(t *ansiState) bool {
|
func (s *ansiState) equals(t *ansiState) bool {
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return !s.colored()
|
return !s.colored()
|
||||||
}
|
}
|
||||||
return s.fg == t.fg && s.bg == t.bg && s.bold == t.bold
|
return s.fg == t.fg && s.bg == t.bg && s.attr == t.attr
|
||||||
}
|
}
|
||||||
|
|
||||||
var ansiRegex *regexp.Regexp
|
var ansiRegex *regexp.Regexp
|
||||||
@@ -94,9 +96,9 @@ func interpretCode(ansiCode string, prevState *ansiState) *ansiState {
|
|||||||
// State
|
// State
|
||||||
var state *ansiState
|
var state *ansiState
|
||||||
if prevState == nil {
|
if prevState == nil {
|
||||||
state = &ansiState{-1, -1, false}
|
state = &ansiState{-1, -1, 0}
|
||||||
} else {
|
} else {
|
||||||
state = &ansiState{prevState.fg, prevState.bg, prevState.bold}
|
state = &ansiState{prevState.fg, prevState.bg, prevState.attr}
|
||||||
}
|
}
|
||||||
if ansiCode[1] != '[' || ansiCode[len(ansiCode)-1] != 'm' {
|
if ansiCode[1] != '[' || ansiCode[len(ansiCode)-1] != 'm' {
|
||||||
return state
|
return state
|
||||||
@@ -108,7 +110,7 @@ func interpretCode(ansiCode string, prevState *ansiState) *ansiState {
|
|||||||
init := func() {
|
init := func() {
|
||||||
state.fg = -1
|
state.fg = -1
|
||||||
state.bg = -1
|
state.bg = -1
|
||||||
state.bold = false
|
state.attr = 0
|
||||||
state256 = 0
|
state256 = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +134,15 @@ func interpretCode(ansiCode string, prevState *ansiState) *ansiState {
|
|||||||
case 49:
|
case 49:
|
||||||
state.bg = -1
|
state.bg = -1
|
||||||
case 1:
|
case 1:
|
||||||
state.bold = true
|
state.attr = curses.Bold
|
||||||
|
case 2:
|
||||||
|
state.attr = curses.Dim
|
||||||
|
case 4:
|
||||||
|
state.attr = curses.Underline
|
||||||
|
case 5:
|
||||||
|
state.attr = curses.Blink
|
||||||
|
case 7:
|
||||||
|
state.attr = curses.Reverse
|
||||||
case 0:
|
case 0:
|
||||||
init()
|
init()
|
||||||
default:
|
default:
|
||||||
|
@@ -3,13 +3,19 @@ package fzf
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/junegunn/fzf/src/curses"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestExtractColor(t *testing.T) {
|
func TestExtractColor(t *testing.T) {
|
||||||
assert := func(offset ansiOffset, b int32, e int32, fg int, bg int, bold bool) {
|
assert := func(offset ansiOffset, b int32, e int32, fg int, bg int, bold bool) {
|
||||||
|
var attr curses.Attr
|
||||||
|
if bold {
|
||||||
|
attr = curses.Bold
|
||||||
|
}
|
||||||
if offset.offset[0] != b || offset.offset[1] != e ||
|
if offset.offset[0] != b || offset.offset[1] != e ||
|
||||||
offset.color.fg != fg || offset.color.bg != bg || offset.color.bold != bold {
|
offset.color.fg != fg || offset.color.bg != bg || offset.color.attr != attr {
|
||||||
t.Error(offset, b, e, fg, bg, bold)
|
t.Error(offset, b, e, fg, bg, attr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +127,7 @@ func TestExtractColor(t *testing.T) {
|
|||||||
if len(*offsets) != 1 {
|
if len(*offsets) != 1 {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
if state.fg != 2 || state.bg != -1 || !state.bold {
|
if state.fg != 2 || state.bg != -1 || state.attr == 0 {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
assert((*offsets)[0], 6, 11, 2, -1, true)
|
assert((*offsets)[0], 6, 11, 2, -1, true)
|
||||||
@@ -132,7 +138,7 @@ func TestExtractColor(t *testing.T) {
|
|||||||
if len(*offsets) != 1 {
|
if len(*offsets) != 1 {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
if state.fg != 2 || state.bg != -1 || !state.bold {
|
if state.fg != 2 || state.bg != -1 || state.attr == 0 {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
assert((*offsets)[0], 0, 11, 2, -1, true)
|
assert((*offsets)[0], 0, 11, 2, -1, true)
|
||||||
@@ -143,7 +149,7 @@ func TestExtractColor(t *testing.T) {
|
|||||||
if len(*offsets) != 2 {
|
if len(*offsets) != 2 {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
if state.fg != 200 || state.bg != 100 || state.bold {
|
if state.fg != 200 || state.bg != 100 || state.attr > 0 {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
assert((*offsets)[0], 0, 6, 2, -1, true)
|
assert((*offsets)[0], 0, 6, 2, -1, true)
|
||||||
|
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Current version
|
// Current version
|
||||||
version = "0.15.2"
|
version = "0.15.5"
|
||||||
|
|
||||||
// Core
|
// Core
|
||||||
coordinatorDelayMax time.Duration = 100 * time.Millisecond
|
coordinatorDelayMax time.Duration = 100 * time.Millisecond
|
||||||
|
@@ -23,6 +23,16 @@ import (
|
|||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
Bold = C.A_BOLD
|
||||||
|
Dim = C.A_DIM
|
||||||
|
Blink = C.A_BLINK
|
||||||
|
Reverse = C.A_REVERSE
|
||||||
|
Underline = C.A_UNDERLINE
|
||||||
|
)
|
||||||
|
|
||||||
|
type Attr C.int
|
||||||
|
|
||||||
// Types of user action
|
// Types of user action
|
||||||
const (
|
const (
|
||||||
Rune = iota
|
Rune = iota
|
||||||
@@ -103,7 +113,8 @@ const (
|
|||||||
|
|
||||||
// Pallete
|
// Pallete
|
||||||
const (
|
const (
|
||||||
ColNormal = iota
|
_ = iota
|
||||||
|
ColNormal
|
||||||
ColPrompt
|
ColPrompt
|
||||||
ColMatch
|
ColMatch
|
||||||
ColCurrent
|
ColCurrent
|
||||||
@@ -124,7 +135,6 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ColorTheme struct {
|
type ColorTheme struct {
|
||||||
UseDefault bool
|
|
||||||
Fg int16
|
Fg int16
|
||||||
Bg int16
|
Bg int16
|
||||||
DarkBg int16
|
DarkBg int16
|
||||||
@@ -158,7 +168,8 @@ type MouseEvent struct {
|
|||||||
var (
|
var (
|
||||||
_buf []byte
|
_buf []byte
|
||||||
_in *os.File
|
_in *os.File
|
||||||
_color func(int, bool) C.int
|
_color bool
|
||||||
|
_colorFn func(int, Attr) C.int
|
||||||
_colorMap map[int]int
|
_colorMap map[int]int
|
||||||
_prevDownTime time.Time
|
_prevDownTime time.Time
|
||||||
_clickY []int
|
_clickY []int
|
||||||
@@ -166,10 +177,6 @@ var (
|
|||||||
Default16 *ColorTheme
|
Default16 *ColorTheme
|
||||||
Dark256 *ColorTheme
|
Dark256 *ColorTheme
|
||||||
Light256 *ColorTheme
|
Light256 *ColorTheme
|
||||||
FG int
|
|
||||||
CurrentFG int
|
|
||||||
BG int
|
|
||||||
DarkBG int
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Window struct {
|
type Window struct {
|
||||||
@@ -182,12 +189,16 @@ type Window struct {
|
|||||||
|
|
||||||
func NewWindow(top int, left int, width int, height int, border bool) *Window {
|
func NewWindow(top int, left int, width int, height int, border bool) *Window {
|
||||||
win := C.newwin(C.int(height), C.int(width), C.int(top), C.int(left))
|
win := C.newwin(C.int(height), C.int(width), C.int(top), C.int(left))
|
||||||
|
if _color {
|
||||||
|
C.wbkgd(win, C.chtype(C.COLOR_PAIR(ColNormal)))
|
||||||
|
}
|
||||||
if border {
|
if border {
|
||||||
attr := _color(ColBorder, false)
|
attr := _colorFn(ColBorder, 0)
|
||||||
C.wattron(win, attr)
|
C.wattron(win, attr)
|
||||||
C.box(win, 0, 0)
|
C.box(win, 0, 0)
|
||||||
C.wattroff(win, attr)
|
C.wattroff(win, attr)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Window{
|
return &Window{
|
||||||
win: win,
|
win: win,
|
||||||
Top: top,
|
Top: top,
|
||||||
@@ -199,7 +210,6 @@ func NewWindow(top int, left int, width int, height int, border bool) *Window {
|
|||||||
|
|
||||||
func EmptyTheme() *ColorTheme {
|
func EmptyTheme() *ColorTheme {
|
||||||
return &ColorTheme{
|
return &ColorTheme{
|
||||||
UseDefault: true,
|
|
||||||
Fg: colUndefined,
|
Fg: colUndefined,
|
||||||
Bg: colUndefined,
|
Bg: colUndefined,
|
||||||
DarkBg: colUndefined,
|
DarkBg: colUndefined,
|
||||||
@@ -220,9 +230,8 @@ func init() {
|
|||||||
_clickY = []int{}
|
_clickY = []int{}
|
||||||
_colorMap = make(map[int]int)
|
_colorMap = make(map[int]int)
|
||||||
Default16 = &ColorTheme{
|
Default16 = &ColorTheme{
|
||||||
UseDefault: true,
|
Fg: colDefault,
|
||||||
Fg: 15,
|
Bg: colDefault,
|
||||||
Bg: 0,
|
|
||||||
DarkBg: C.COLOR_BLACK,
|
DarkBg: C.COLOR_BLACK,
|
||||||
Prompt: C.COLOR_BLUE,
|
Prompt: C.COLOR_BLUE,
|
||||||
Match: C.COLOR_GREEN,
|
Match: C.COLOR_GREEN,
|
||||||
@@ -235,9 +244,8 @@ func init() {
|
|||||||
Header: C.COLOR_CYAN,
|
Header: C.COLOR_CYAN,
|
||||||
Border: C.COLOR_BLACK}
|
Border: C.COLOR_BLACK}
|
||||||
Dark256 = &ColorTheme{
|
Dark256 = &ColorTheme{
|
||||||
UseDefault: true,
|
Fg: colDefault,
|
||||||
Fg: 15,
|
Bg: colDefault,
|
||||||
Bg: 0,
|
|
||||||
DarkBg: 236,
|
DarkBg: 236,
|
||||||
Prompt: 110,
|
Prompt: 110,
|
||||||
Match: 108,
|
Match: 108,
|
||||||
@@ -250,9 +258,8 @@ func init() {
|
|||||||
Header: 109,
|
Header: 109,
|
||||||
Border: 59}
|
Border: 59}
|
||||||
Light256 = &ColorTheme{
|
Light256 = &ColorTheme{
|
||||||
UseDefault: true,
|
Fg: colDefault,
|
||||||
Fg: 15,
|
Bg: colDefault,
|
||||||
Bg: 0,
|
|
||||||
DarkBg: 251,
|
DarkBg: 251,
|
||||||
Prompt: 25,
|
Prompt: 25,
|
||||||
Match: 66,
|
Match: 66,
|
||||||
@@ -266,22 +273,19 @@ func init() {
|
|||||||
Border: 145}
|
Border: 145}
|
||||||
}
|
}
|
||||||
|
|
||||||
func attrColored(pair int, bold bool) C.int {
|
func attrColored(pair int, a Attr) C.int {
|
||||||
var attr C.int
|
var attr C.int
|
||||||
if pair > ColNormal {
|
if pair > 0 {
|
||||||
attr = C.COLOR_PAIR(C.int(pair))
|
attr = C.COLOR_PAIR(C.int(pair))
|
||||||
}
|
}
|
||||||
if bold {
|
return attr | C.int(a)
|
||||||
attr = attr | C.A_BOLD
|
|
||||||
}
|
|
||||||
return attr
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func attrMono(pair int, bold bool) C.int {
|
func attrMono(pair int, a Attr) C.int {
|
||||||
var attr C.int
|
var attr C.int
|
||||||
switch pair {
|
switch pair {
|
||||||
case ColCurrent:
|
case ColCurrent:
|
||||||
if bold {
|
if a&C.A_BOLD == C.A_BOLD {
|
||||||
attr = C.A_REVERSE
|
attr = C.A_REVERSE
|
||||||
}
|
}
|
||||||
case ColMatch:
|
case ColMatch:
|
||||||
@@ -289,7 +293,7 @@ func attrMono(pair int, bold bool) C.int {
|
|||||||
case ColCurrentMatch:
|
case ColCurrentMatch:
|
||||||
attr = C.A_UNDERLINE | C.A_REVERSE
|
attr = C.A_UNDERLINE | C.A_REVERSE
|
||||||
}
|
}
|
||||||
if bold {
|
if a&C.A_BOLD == C.A_BOLD {
|
||||||
attr = attr | C.A_BOLD
|
attr = attr | C.A_BOLD
|
||||||
}
|
}
|
||||||
return attr
|
return attr
|
||||||
@@ -337,7 +341,8 @@ func Init(theme *ColorTheme, black bool, mouse bool) {
|
|||||||
C.noecho()
|
C.noecho()
|
||||||
C.raw() // stty dsusp undef
|
C.raw() // stty dsusp undef
|
||||||
|
|
||||||
if theme != nil {
|
_color = theme != nil
|
||||||
|
if _color {
|
||||||
C.start_color()
|
C.start_color()
|
||||||
var baseTheme *ColorTheme
|
var baseTheme *ColorTheme
|
||||||
if C.tigetnum(C.CString("colors")) >= 256 {
|
if C.tigetnum(C.CString("colors")) >= 256 {
|
||||||
@@ -346,52 +351,57 @@ func Init(theme *ColorTheme, black bool, mouse bool) {
|
|||||||
baseTheme = Default16
|
baseTheme = Default16
|
||||||
}
|
}
|
||||||
initPairs(baseTheme, theme, black)
|
initPairs(baseTheme, theme, black)
|
||||||
_color = attrColored
|
C.bkgd(C.chtype(C.COLOR_PAIR(ColNormal)))
|
||||||
|
_colorFn = attrColored
|
||||||
} else {
|
} else {
|
||||||
_color = attrMono
|
_colorFn = attrMono
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func override(a int16, b int16) C.short {
|
func override(baseTheme *ColorTheme, theme *ColorTheme) {
|
||||||
if b == colUndefined {
|
o := func(a int16, b int16) int16 {
|
||||||
return C.short(a)
|
if b == colUndefined {
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
return b
|
||||||
}
|
}
|
||||||
return C.short(b)
|
theme.Fg = o(baseTheme.Fg, theme.Fg)
|
||||||
|
theme.Bg = o(baseTheme.Bg, theme.Bg)
|
||||||
|
theme.DarkBg = o(baseTheme.DarkBg, theme.DarkBg)
|
||||||
|
theme.Prompt = o(baseTheme.Prompt, theme.Prompt)
|
||||||
|
theme.Match = o(baseTheme.Match, theme.Match)
|
||||||
|
theme.Current = o(baseTheme.Current, theme.Current)
|
||||||
|
theme.CurrentMatch = o(baseTheme.CurrentMatch, theme.CurrentMatch)
|
||||||
|
theme.Spinner = o(baseTheme.Spinner, theme.Spinner)
|
||||||
|
theme.Info = o(baseTheme.Info, theme.Info)
|
||||||
|
theme.Cursor = o(baseTheme.Cursor, theme.Cursor)
|
||||||
|
theme.Selected = o(baseTheme.Selected, theme.Selected)
|
||||||
|
theme.Header = o(baseTheme.Header, theme.Header)
|
||||||
|
theme.Border = o(baseTheme.Border, theme.Border)
|
||||||
}
|
}
|
||||||
|
|
||||||
func initPairs(baseTheme *ColorTheme, theme *ColorTheme, black bool) {
|
func initPairs(baseTheme *ColorTheme, theme *ColorTheme, black bool) {
|
||||||
fg := override(baseTheme.Fg, theme.Fg)
|
|
||||||
bg := override(baseTheme.Bg, theme.Bg)
|
|
||||||
if black {
|
if black {
|
||||||
bg = C.COLOR_BLACK
|
theme.Bg = C.COLOR_BLACK
|
||||||
} else if theme.UseDefault {
|
|
||||||
fg = colDefault
|
|
||||||
bg = colDefault
|
|
||||||
C.use_default_colors()
|
|
||||||
}
|
|
||||||
if theme.UseDefault {
|
|
||||||
FG = colDefault
|
|
||||||
BG = colDefault
|
|
||||||
} else {
|
|
||||||
FG = int(fg)
|
|
||||||
BG = int(bg)
|
|
||||||
C.assume_default_colors(C.int(override(baseTheme.Fg, theme.Fg)), C.int(bg))
|
|
||||||
}
|
}
|
||||||
|
// Updates theme
|
||||||
|
override(baseTheme, theme)
|
||||||
|
|
||||||
currentFG := override(baseTheme.Current, theme.Current)
|
C.assume_default_colors(C.int(theme.Fg), C.int(theme.Bg))
|
||||||
darkBG := override(baseTheme.DarkBg, theme.DarkBg)
|
initPair := func(group C.short, fg int16, bg int16) {
|
||||||
CurrentFG = int(currentFG)
|
C.init_pair(group, C.short(fg), C.short(bg))
|
||||||
DarkBG = int(darkBG)
|
}
|
||||||
C.init_pair(ColPrompt, override(baseTheme.Prompt, theme.Prompt), bg)
|
initPair(ColNormal, theme.Fg, theme.Bg)
|
||||||
C.init_pair(ColMatch, override(baseTheme.Match, theme.Match), bg)
|
initPair(ColPrompt, theme.Prompt, theme.Bg)
|
||||||
C.init_pair(ColCurrent, currentFG, darkBG)
|
initPair(ColMatch, theme.Match, theme.Bg)
|
||||||
C.init_pair(ColCurrentMatch, override(baseTheme.CurrentMatch, theme.CurrentMatch), darkBG)
|
initPair(ColCurrent, theme.Current, theme.DarkBg)
|
||||||
C.init_pair(ColSpinner, override(baseTheme.Spinner, theme.Spinner), bg)
|
initPair(ColCurrentMatch, theme.CurrentMatch, theme.DarkBg)
|
||||||
C.init_pair(ColInfo, override(baseTheme.Info, theme.Info), bg)
|
initPair(ColSpinner, theme.Spinner, theme.Bg)
|
||||||
C.init_pair(ColCursor, override(baseTheme.Cursor, theme.Cursor), darkBG)
|
initPair(ColInfo, theme.Info, theme.Bg)
|
||||||
C.init_pair(ColSelected, override(baseTheme.Selected, theme.Selected), darkBG)
|
initPair(ColCursor, theme.Cursor, theme.DarkBg)
|
||||||
C.init_pair(ColHeader, override(baseTheme.Header, theme.Header), bg)
|
initPair(ColSelected, theme.Selected, theme.DarkBg)
|
||||||
C.init_pair(ColBorder, override(baseTheme.Border, theme.Border), bg)
|
initPair(ColHeader, theme.Header, theme.Bg)
|
||||||
|
initPair(ColBorder, theme.Border, theme.Bg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Close() {
|
func Close() {
|
||||||
@@ -648,8 +658,8 @@ func (w *Window) Print(text string) {
|
|||||||
}, text)))
|
}, text)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) CPrint(pair int, bold bool, text string) {
|
func (w *Window) CPrint(pair int, a Attr, text string) {
|
||||||
attr := _color(pair, bold)
|
attr := _colorFn(pair, a)
|
||||||
C.wattron(w.win, attr)
|
C.wattron(w.win, attr)
|
||||||
w.Print(text)
|
w.Print(text)
|
||||||
C.wattroff(w.win, attr)
|
C.wattroff(w.win, attr)
|
||||||
@@ -675,8 +685,8 @@ func (w *Window) Fill(str string) bool {
|
|||||||
return C.waddstr(w.win, C.CString(str)) == C.OK
|
return C.waddstr(w.win, C.CString(str)) == C.OK
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) CFill(str string, fg int, bg int, bold bool) bool {
|
func (w *Window) CFill(str string, fg int, bg int, a Attr) bool {
|
||||||
attr := _color(PairFor(fg, bg), bold)
|
attr := _colorFn(PairFor(fg, bg), a)
|
||||||
C.wattron(w.win, attr)
|
C.wattron(w.win, attr)
|
||||||
ret := w.Fill(str)
|
ret := w.Fill(str)
|
||||||
C.wattroff(w.win, attr)
|
C.wattroff(w.win, attr)
|
||||||
|
@@ -246,7 +246,7 @@ func nextString(args []string, i *int, message string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func optionalNextString(args []string, i *int) string {
|
func optionalNextString(args []string, i *int) string {
|
||||||
if len(args) > *i+1 {
|
if len(args) > *i+1 && !strings.HasPrefix(args[*i+1], "-") {
|
||||||
*i++
|
*i++
|
||||||
return args[*i]
|
return args[*i]
|
||||||
}
|
}
|
||||||
@@ -499,10 +499,8 @@ func parseTheme(defaultTheme *curses.ColorTheme, str string) *curses.ColorTheme
|
|||||||
switch pair[0] {
|
switch pair[0] {
|
||||||
case "fg":
|
case "fg":
|
||||||
theme.Fg = ansi
|
theme.Fg = ansi
|
||||||
theme.UseDefault = theme.UseDefault && ansi < 0
|
|
||||||
case "bg":
|
case "bg":
|
||||||
theme.Bg = ansi
|
theme.Bg = ansi
|
||||||
theme.UseDefault = theme.UseDefault && ansi < 0
|
|
||||||
case "fg+":
|
case "fg+":
|
||||||
theme.Current = ansi
|
theme.Current = ansi
|
||||||
case "bg+":
|
case "bg+":
|
||||||
|
@@ -299,20 +299,14 @@ func TestColorSpec(t *testing.T) {
|
|||||||
}
|
}
|
||||||
customized.Fg = curses.Dark256.Fg
|
customized.Fg = curses.Dark256.Fg
|
||||||
customized.Bg = curses.Dark256.Bg
|
customized.Bg = curses.Dark256.Bg
|
||||||
if *curses.Dark256 == *customized {
|
if *curses.Dark256 != *customized {
|
||||||
t.Errorf("colors should now be equivalent")
|
t.Errorf("colors should now be equivalent: %v, %v", curses.Dark256, customized)
|
||||||
}
|
}
|
||||||
|
|
||||||
customized = parseTheme(theme, "fg:231,dark,bg:232")
|
customized = parseTheme(theme, "fg:231,dark,bg:232")
|
||||||
if customized.Fg != curses.Dark256.Fg || customized.Bg == curses.Dark256.Bg {
|
if customized.Fg != curses.Dark256.Fg || customized.Bg == curses.Dark256.Bg {
|
||||||
t.Errorf("color not customized")
|
t.Errorf("color not customized")
|
||||||
}
|
}
|
||||||
if customized.UseDefault {
|
|
||||||
t.Errorf("not using default colors")
|
|
||||||
}
|
|
||||||
if !curses.Dark256.UseDefault {
|
|
||||||
t.Errorf("using default colors")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestParseNilTheme(t *testing.T) {
|
func TestParseNilTheme(t *testing.T) {
|
||||||
|
@@ -163,12 +163,13 @@ func parseTerms(fuzzy bool, caseMode Case, str string) []termSet {
|
|||||||
|
|
||||||
if strings.HasPrefix(text, "!") {
|
if strings.HasPrefix(text, "!") {
|
||||||
inv = true
|
inv = true
|
||||||
|
typ = termExact
|
||||||
text = text[1:]
|
text = text[1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(text, "'") {
|
if strings.HasPrefix(text, "'") {
|
||||||
// Flip exactness
|
// Flip exactness
|
||||||
if fuzzy {
|
if fuzzy && !inv {
|
||||||
typ = termExact
|
typ = termExact
|
||||||
text = text[1:]
|
text = text[1:]
|
||||||
} else {
|
} else {
|
||||||
|
@@ -22,15 +22,15 @@ func TestParseTermsExtended(t *testing.T) {
|
|||||||
terms[1][0].typ != termExact || terms[1][0].inv ||
|
terms[1][0].typ != termExact || terms[1][0].inv ||
|
||||||
terms[2][0].typ != termPrefix || terms[2][0].inv ||
|
terms[2][0].typ != termPrefix || terms[2][0].inv ||
|
||||||
terms[3][0].typ != termSuffix || terms[3][0].inv ||
|
terms[3][0].typ != termSuffix || terms[3][0].inv ||
|
||||||
terms[4][0].typ != termFuzzy || !terms[4][0].inv ||
|
terms[4][0].typ != termExact || !terms[4][0].inv ||
|
||||||
terms[5][0].typ != termExact || !terms[5][0].inv ||
|
terms[5][0].typ != termFuzzy || !terms[5][0].inv ||
|
||||||
terms[6][0].typ != termPrefix || !terms[6][0].inv ||
|
terms[6][0].typ != termPrefix || !terms[6][0].inv ||
|
||||||
terms[7][0].typ != termSuffix || !terms[7][0].inv ||
|
terms[7][0].typ != termSuffix || !terms[7][0].inv ||
|
||||||
terms[7][1].typ != termEqual || terms[7][1].inv ||
|
terms[7][1].typ != termEqual || terms[7][1].inv ||
|
||||||
terms[8][0].typ != termPrefix || terms[8][0].inv ||
|
terms[8][0].typ != termPrefix || terms[8][0].inv ||
|
||||||
terms[8][1].typ != termExact || terms[8][1].inv ||
|
terms[8][1].typ != termExact || terms[8][1].inv ||
|
||||||
terms[8][2].typ != termSuffix || terms[8][2].inv ||
|
terms[8][2].typ != termSuffix || terms[8][2].inv ||
|
||||||
terms[8][3].typ != termFuzzy || !terms[8][3].inv {
|
terms[8][3].typ != termExact || !terms[8][3].inv {
|
||||||
t.Errorf("%s", terms)
|
t.Errorf("%s", terms)
|
||||||
}
|
}
|
||||||
for idx, termSet := range terms[:8] {
|
for idx, termSet := range terms[:8] {
|
||||||
|
@@ -3,6 +3,7 @@ package fzf
|
|||||||
import (
|
import (
|
||||||
"math"
|
"math"
|
||||||
"sort"
|
"sort"
|
||||||
|
"unicode"
|
||||||
|
|
||||||
"github.com/junegunn/fzf/src/curses"
|
"github.com/junegunn/fzf/src/curses"
|
||||||
"github.com/junegunn/fzf/src/util"
|
"github.com/junegunn/fzf/src/util"
|
||||||
@@ -14,7 +15,7 @@ type Offset [2]int32
|
|||||||
type colorOffset struct {
|
type colorOffset struct {
|
||||||
offset [2]int32
|
offset [2]int32
|
||||||
color int
|
color int
|
||||||
bold bool
|
attr curses.Attr
|
||||||
index int32
|
index int32
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,21 +57,21 @@ func buildResult(item *Item, offsets []Offset, score int, trimLen int) *Result {
|
|||||||
case byLength:
|
case byLength:
|
||||||
// If offsets is empty, trimLen will be 0, but we don't care
|
// If offsets is empty, trimLen will be 0, but we don't care
|
||||||
val = util.AsUint16(trimLen)
|
val = util.AsUint16(trimLen)
|
||||||
case byBegin:
|
case byBegin, byEnd:
|
||||||
if validOffsetFound {
|
if validOffsetFound {
|
||||||
whitePrefixLen := 0
|
whitePrefixLen := 0
|
||||||
for idx := 0; idx < numChars; idx++ {
|
for idx := 0; idx < numChars; idx++ {
|
||||||
r := item.text.Get(idx)
|
r := item.text.Get(idx)
|
||||||
whitePrefixLen = idx
|
whitePrefixLen = idx
|
||||||
if idx == minBegin || r != ' ' && r != '\t' {
|
if idx == minBegin || !unicode.IsSpace(r) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val = util.AsUint16(minBegin - whitePrefixLen)
|
if criterion == byBegin {
|
||||||
}
|
val = util.AsUint16(minBegin - whitePrefixLen)
|
||||||
case byEnd:
|
} else {
|
||||||
if validOffsetFound {
|
val = util.AsUint16(math.MaxUint16 - math.MaxUint16*(maxEnd-whitePrefixLen)/trimLen)
|
||||||
val = util.AsUint16(1 + numChars - maxEnd)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.rank.points[idx] = val
|
result.rank.points[idx] = val
|
||||||
@@ -91,14 +92,14 @@ func minRank() rank {
|
|||||||
return rank{index: 0, points: [4]uint16{math.MaxUint16, 0, 0, 0}}
|
return rank{index: 0, points: [4]uint16{math.MaxUint16, 0, 0, 0}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (result *Result) colorOffsets(matchOffsets []Offset, color int, bold bool, current bool) []colorOffset {
|
func (result *Result) colorOffsets(matchOffsets []Offset, theme *curses.ColorTheme, color int, attr curses.Attr, current bool) []colorOffset {
|
||||||
itemColors := result.item.Colors()
|
itemColors := result.item.Colors()
|
||||||
|
|
||||||
|
// No ANSI code, or --color=no
|
||||||
if len(itemColors) == 0 {
|
if len(itemColors) == 0 {
|
||||||
var offsets []colorOffset
|
var offsets []colorOffset
|
||||||
for _, off := range matchOffsets {
|
for _, off := range matchOffsets {
|
||||||
|
offsets = append(offsets, colorOffset{offset: [2]int32{off[0], off[1]}, color: color, attr: attr})
|
||||||
offsets = append(offsets, colorOffset{offset: [2]int32{off[0], off[1]}, color: color, bold: bold})
|
|
||||||
}
|
}
|
||||||
return offsets
|
return offsets
|
||||||
}
|
}
|
||||||
@@ -142,29 +143,29 @@ func (result *Result) colorOffsets(matchOffsets []Offset, color int, bold bool,
|
|||||||
if curr != 0 && idx > start {
|
if curr != 0 && idx > start {
|
||||||
if curr == -1 {
|
if curr == -1 {
|
||||||
colors = append(colors, colorOffset{
|
colors = append(colors, colorOffset{
|
||||||
offset: [2]int32{int32(start), int32(idx)}, color: color, bold: bold})
|
offset: [2]int32{int32(start), int32(idx)}, color: color, attr: attr})
|
||||||
} else {
|
} else {
|
||||||
ansi := itemColors[curr-1]
|
ansi := itemColors[curr-1]
|
||||||
fg := ansi.color.fg
|
fg := ansi.color.fg
|
||||||
if fg == -1 {
|
if fg == -1 {
|
||||||
if current {
|
if current {
|
||||||
fg = curses.CurrentFG
|
fg = int(theme.Current)
|
||||||
} else {
|
} else {
|
||||||
fg = curses.FG
|
fg = int(theme.Fg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bg := ansi.color.bg
|
bg := ansi.color.bg
|
||||||
if bg == -1 {
|
if bg == -1 {
|
||||||
if current {
|
if current {
|
||||||
bg = curses.DarkBG
|
bg = int(theme.DarkBg)
|
||||||
} else {
|
} else {
|
||||||
bg = curses.BG
|
bg = int(theme.Bg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
colors = append(colors, colorOffset{
|
colors = append(colors, colorOffset{
|
||||||
offset: [2]int32{int32(start), int32(idx)},
|
offset: [2]int32{int32(start), int32(idx)},
|
||||||
color: curses.PairFor(fg, bg),
|
color: curses.PairFor(fg, bg),
|
||||||
bold: ansi.color.bold || bold})
|
attr: ansi.color.attr | attr})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -97,16 +97,20 @@ func TestColorOffset(t *testing.T) {
|
|||||||
item := Result{
|
item := Result{
|
||||||
item: &Item{
|
item: &Item{
|
||||||
colors: &[]ansiOffset{
|
colors: &[]ansiOffset{
|
||||||
ansiOffset{[2]int32{0, 20}, ansiState{1, 5, false}},
|
ansiOffset{[2]int32{0, 20}, ansiState{1, 5, 0}},
|
||||||
ansiOffset{[2]int32{22, 27}, ansiState{2, 6, true}},
|
ansiOffset{[2]int32{22, 27}, ansiState{2, 6, curses.Bold}},
|
||||||
ansiOffset{[2]int32{30, 32}, ansiState{3, 7, false}},
|
ansiOffset{[2]int32{30, 32}, ansiState{3, 7, 0}},
|
||||||
ansiOffset{[2]int32{33, 40}, ansiState{4, 8, true}}}}}
|
ansiOffset{[2]int32{33, 40}, ansiState{4, 8, curses.Bold}}}}}
|
||||||
// [{[0 5] 9 false} {[5 15] 99 false} {[15 20] 9 false} {[22 25] 10 true} {[25 35] 99 false} {[35 40] 11 true}]
|
// [{[0 5] 9 false} {[5 15] 99 false} {[15 20] 9 false} {[22 25] 10 true} {[25 35] 99 false} {[35 40] 11 true}]
|
||||||
|
|
||||||
colors := item.colorOffsets(offsets, 99, false, true)
|
colors := item.colorOffsets(offsets, curses.Dark256, 99, 0, true)
|
||||||
assert := func(idx int, b int32, e int32, c int, bold bool) {
|
assert := func(idx int, b int32, e int32, c int, bold bool) {
|
||||||
|
var attr curses.Attr
|
||||||
|
if bold {
|
||||||
|
attr = curses.Bold
|
||||||
|
}
|
||||||
o := colors[idx]
|
o := colors[idx]
|
||||||
if o.offset[0] != b || o.offset[1] != e || o.color != c || o.bold != bold {
|
if o.offset[0] != b || o.offset[1] != e || o.color != c || o.attr != attr {
|
||||||
t.Error(o)
|
t.Error(o)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
163
src/terminal.go
163
src/terminal.go
@@ -20,6 +20,12 @@ import (
|
|||||||
|
|
||||||
// import "github.com/pkg/profile"
|
// import "github.com/pkg/profile"
|
||||||
|
|
||||||
|
var placeholder *regexp.Regexp
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
placeholder = regexp.MustCompile("\\\\?(?:{[0-9,-.]*}|{q})")
|
||||||
|
}
|
||||||
|
|
||||||
type jumpMode int
|
type jumpMode int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -51,6 +57,7 @@ type Terminal struct {
|
|||||||
multi bool
|
multi bool
|
||||||
sort bool
|
sort bool
|
||||||
toggleSort bool
|
toggleSort bool
|
||||||
|
delimiter Delimiter
|
||||||
expect map[int]string
|
expect map[int]string
|
||||||
keymap map[int]actionType
|
keymap map[int]actionType
|
||||||
execmap map[int]string
|
execmap map[int]string
|
||||||
@@ -83,20 +90,16 @@ type Terminal struct {
|
|||||||
suppress bool
|
suppress bool
|
||||||
startChan chan bool
|
startChan chan bool
|
||||||
slab *util.Slab
|
slab *util.Slab
|
||||||
|
theme *C.ColorTheme
|
||||||
}
|
}
|
||||||
|
|
||||||
type selectedItem struct {
|
type selectedItem struct {
|
||||||
at time.Time
|
at time.Time
|
||||||
text string
|
item *Item
|
||||||
}
|
}
|
||||||
|
|
||||||
type byTimeOrder []selectedItem
|
type byTimeOrder []selectedItem
|
||||||
|
|
||||||
type previewRequest struct {
|
|
||||||
ok bool
|
|
||||||
str string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a byTimeOrder) Len() int {
|
func (a byTimeOrder) Len() int {
|
||||||
return len(a)
|
return len(a)
|
||||||
}
|
}
|
||||||
@@ -267,6 +270,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
|
|||||||
multi: opts.Multi,
|
multi: opts.Multi,
|
||||||
sort: opts.Sort > 0,
|
sort: opts.Sort > 0,
|
||||||
toggleSort: opts.ToggleSort,
|
toggleSort: opts.ToggleSort,
|
||||||
|
delimiter: opts.Delimiter,
|
||||||
expect: opts.Expect,
|
expect: opts.Expect,
|
||||||
keymap: opts.Keymap,
|
keymap: opts.Keymap,
|
||||||
execmap: opts.Execmap,
|
execmap: opts.Execmap,
|
||||||
@@ -292,6 +296,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
|
|||||||
mutex: sync.Mutex{},
|
mutex: sync.Mutex{},
|
||||||
suppress: true,
|
suppress: true,
|
||||||
slab: util.MakeSlab(slab16Size, slab32Size),
|
slab: util.MakeSlab(slab16Size, slab32Size),
|
||||||
|
theme: opts.Theme,
|
||||||
startChan: make(chan bool, 1),
|
startChan: make(chan bool, 1),
|
||||||
initFunc: func() {
|
initFunc: func() {
|
||||||
C.Init(opts.Theme, opts.Black, opts.Mouse)
|
C.Init(opts.Theme, opts.Black, opts.Mouse)
|
||||||
@@ -373,7 +378,7 @@ func (t *Terminal) output() bool {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for _, sel := range t.sortSelected() {
|
for _, sel := range t.sortSelected() {
|
||||||
t.printer(sel.text)
|
t.printer(sel.item.AsString(t.ansi))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return found
|
return found
|
||||||
@@ -526,24 +531,24 @@ func (t *Terminal) placeCursor() {
|
|||||||
|
|
||||||
func (t *Terminal) printPrompt() {
|
func (t *Terminal) printPrompt() {
|
||||||
t.move(0, 0, true)
|
t.move(0, 0, true)
|
||||||
t.window.CPrint(C.ColPrompt, true, t.prompt)
|
t.window.CPrint(C.ColPrompt, C.Bold, t.prompt)
|
||||||
t.window.CPrint(C.ColNormal, true, string(t.input))
|
t.window.CPrint(C.ColNormal, C.Bold, string(t.input))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Terminal) printInfo() {
|
func (t *Terminal) printInfo() {
|
||||||
if t.inlineInfo {
|
if t.inlineInfo {
|
||||||
t.move(0, displayWidth([]rune(t.prompt))+displayWidth(t.input)+1, true)
|
t.move(0, displayWidth([]rune(t.prompt))+displayWidth(t.input)+1, true)
|
||||||
if t.reading {
|
if t.reading {
|
||||||
t.window.CPrint(C.ColSpinner, true, " < ")
|
t.window.CPrint(C.ColSpinner, C.Bold, " < ")
|
||||||
} else {
|
} else {
|
||||||
t.window.CPrint(C.ColPrompt, true, " < ")
|
t.window.CPrint(C.ColPrompt, C.Bold, " < ")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
t.move(1, 0, true)
|
t.move(1, 0, true)
|
||||||
if t.reading {
|
if t.reading {
|
||||||
duration := int64(spinnerDuration)
|
duration := int64(spinnerDuration)
|
||||||
idx := (time.Now().UnixNano() % (duration * int64(len(_spinner)))) / duration
|
idx := (time.Now().UnixNano() % (duration * int64(len(_spinner)))) / duration
|
||||||
t.window.CPrint(C.ColSpinner, true, _spinner[idx])
|
t.window.CPrint(C.ColSpinner, C.Bold, _spinner[idx])
|
||||||
}
|
}
|
||||||
t.move(1, 2, false)
|
t.move(1, 2, false)
|
||||||
}
|
}
|
||||||
@@ -562,7 +567,7 @@ func (t *Terminal) printInfo() {
|
|||||||
if t.progress > 0 && t.progress < 100 {
|
if t.progress > 0 && t.progress < 100 {
|
||||||
output += fmt.Sprintf(" (%d%%)", t.progress)
|
output += fmt.Sprintf(" (%d%%)", t.progress)
|
||||||
}
|
}
|
||||||
t.window.CPrint(C.ColInfo, false, output)
|
t.window.CPrint(C.ColInfo, 0, output)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Terminal) printHeader() {
|
func (t *Terminal) printHeader() {
|
||||||
@@ -586,7 +591,7 @@ func (t *Terminal) printHeader() {
|
|||||||
colors: colors}
|
colors: colors}
|
||||||
|
|
||||||
t.move(line, 2, true)
|
t.move(line, 2, true)
|
||||||
t.printHighlighted(&Result{item: item}, false, C.ColHeader, 0, false)
|
t.printHighlighted(&Result{item: item}, 0, C.ColHeader, 0, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -620,21 +625,21 @@ func (t *Terminal) printItem(result *Result, i int, current bool) {
|
|||||||
} else if current {
|
} else if current {
|
||||||
label = ">"
|
label = ">"
|
||||||
}
|
}
|
||||||
t.window.CPrint(C.ColCursor, true, label)
|
t.window.CPrint(C.ColCursor, C.Bold, label)
|
||||||
if current {
|
if current {
|
||||||
if selected {
|
if selected {
|
||||||
t.window.CPrint(C.ColSelected, true, ">")
|
t.window.CPrint(C.ColSelected, C.Bold, ">")
|
||||||
} else {
|
} else {
|
||||||
t.window.CPrint(C.ColCurrent, true, " ")
|
t.window.CPrint(C.ColCurrent, C.Bold, " ")
|
||||||
}
|
}
|
||||||
t.printHighlighted(result, true, C.ColCurrent, C.ColCurrentMatch, true)
|
t.printHighlighted(result, C.Bold, C.ColCurrent, C.ColCurrentMatch, true)
|
||||||
} else {
|
} else {
|
||||||
if selected {
|
if selected {
|
||||||
t.window.CPrint(C.ColSelected, true, ">")
|
t.window.CPrint(C.ColSelected, C.Bold, ">")
|
||||||
} else {
|
} else {
|
||||||
t.window.Print(" ")
|
t.window.Print(" ")
|
||||||
}
|
}
|
||||||
t.printHighlighted(result, false, 0, C.ColMatch, false)
|
t.printHighlighted(result, 0, C.ColNormal, C.ColMatch, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -690,7 +695,7 @@ func overflow(runes []rune, max int) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Terminal) printHighlighted(result *Result, bold bool, col1 int, col2 int, current bool) {
|
func (t *Terminal) printHighlighted(result *Result, attr C.Attr, col1 int, col2 int, current bool) {
|
||||||
item := result.item
|
item := result.item
|
||||||
|
|
||||||
// Overflow
|
// Overflow
|
||||||
@@ -715,7 +720,7 @@ func (t *Terminal) printHighlighted(result *Result, bold bool, col1 int, col2 in
|
|||||||
maxe = util.Max(maxe, int(offset[1]))
|
maxe = util.Max(maxe, int(offset[1]))
|
||||||
}
|
}
|
||||||
|
|
||||||
offsets := result.colorOffsets(charOffsets, col2, bold, current)
|
offsets := result.colorOffsets(charOffsets, t.theme, col2, attr, current)
|
||||||
maxWidth := t.window.Width - 3
|
maxWidth := t.window.Width - 3
|
||||||
maxe = util.Constrain(maxe+util.Min(maxWidth/2-2, t.hscrollOff), 0, len(text))
|
maxe = util.Constrain(maxe+util.Min(maxWidth/2-2, t.hscrollOff), 0, len(text))
|
||||||
if overflow(text, maxWidth) {
|
if overflow(text, maxWidth) {
|
||||||
@@ -764,11 +769,11 @@ func (t *Terminal) printHighlighted(result *Result, bold bool, col1 int, col2 in
|
|||||||
e := util.Constrain32(offset.offset[1], index, maxOffset)
|
e := util.Constrain32(offset.offset[1], index, maxOffset)
|
||||||
|
|
||||||
substr, prefixWidth = processTabs(text[index:b], prefixWidth)
|
substr, prefixWidth = processTabs(text[index:b], prefixWidth)
|
||||||
t.window.CPrint(col1, bold, substr)
|
t.window.CPrint(col1, attr, substr)
|
||||||
|
|
||||||
if b < e {
|
if b < e {
|
||||||
substr, prefixWidth = processTabs(text[b:e], prefixWidth)
|
substr, prefixWidth = processTabs(text[b:e], prefixWidth)
|
||||||
t.window.CPrint(offset.color, offset.bold, substr)
|
t.window.CPrint(offset.color, offset.attr, substr)
|
||||||
}
|
}
|
||||||
|
|
||||||
index = e
|
index = e
|
||||||
@@ -778,7 +783,7 @@ func (t *Terminal) printHighlighted(result *Result, bold bool, col1 int, col2 in
|
|||||||
}
|
}
|
||||||
if index < maxOffset {
|
if index < maxOffset {
|
||||||
substr, _ = processTabs(text[index:], prefixWidth)
|
substr, _ = processTabs(text[index:], prefixWidth)
|
||||||
t.window.CPrint(col1, bold, substr)
|
t.window.CPrint(col1, attr, substr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -796,6 +801,9 @@ func numLinesMax(str string, max int) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Terminal) printPreview() {
|
func (t *Terminal) printPreview() {
|
||||||
|
if !t.isPreviewEnabled() {
|
||||||
|
return
|
||||||
|
}
|
||||||
t.pwindow.Erase()
|
t.pwindow.Erase()
|
||||||
skip := t.previewer.offset
|
skip := t.previewer.offset
|
||||||
extractColor(t.previewer.text, nil, func(str string, ansi *ansiState) bool {
|
extractColor(t.previewer.text, nil, func(str string, ansi *ansiState) bool {
|
||||||
@@ -812,10 +820,15 @@ func (t *Terminal) printPreview() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ansi != nil && ansi.colored() {
|
if ansi != nil && ansi.colored() {
|
||||||
return t.pwindow.CFill(str, ansi.fg, ansi.bg, ansi.bold)
|
return t.pwindow.CFill(str, ansi.fg, ansi.bg, ansi.attr)
|
||||||
}
|
}
|
||||||
return t.pwindow.Fill(str)
|
return t.pwindow.Fill(str)
|
||||||
})
|
})
|
||||||
|
if t.previewer.offset > 0 {
|
||||||
|
offset := fmt.Sprintf("%d/%d", t.previewer.offset+1, t.previewer.lines)
|
||||||
|
t.pwindow.Move(0, t.pwindow.Width-len(offset))
|
||||||
|
t.pwindow.CPrint(C.ColInfo, C.Reverse, offset)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func processTabs(runes []rune, prefixWidth int) (string, int) {
|
func processTabs(runes []rune, prefixWidth int) (string, int) {
|
||||||
@@ -839,9 +852,7 @@ func (t *Terminal) printAll() {
|
|||||||
t.printPrompt()
|
t.printPrompt()
|
||||||
t.printInfo()
|
t.printInfo()
|
||||||
t.printHeader()
|
t.printHeader()
|
||||||
if t.isPreviewEnabled() {
|
t.printPreview()
|
||||||
t.printPreview()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Terminal) refresh() {
|
func (t *Terminal) refresh() {
|
||||||
@@ -911,8 +922,60 @@ func quoteEntry(entry string) string {
|
|||||||
return "'" + strings.Replace(entry, "'", "'\\''", -1) + "'"
|
return "'" + strings.Replace(entry, "'", "'\\''", -1) + "'"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Terminal) executeCommand(template string, replacement string) {
|
func replacePlaceholder(template string, stripAnsi bool, delimiter Delimiter, query string, items []*Item) string {
|
||||||
command := strings.Replace(template, "{}", replacement, -1)
|
return placeholder.ReplaceAllStringFunc(template, func(match string) string {
|
||||||
|
// Escaped pattern
|
||||||
|
if match[0] == '\\' {
|
||||||
|
return match[1:]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Current query
|
||||||
|
if match == "{q}" {
|
||||||
|
return quoteEntry(query)
|
||||||
|
}
|
||||||
|
|
||||||
|
replacements := make([]string, len(items))
|
||||||
|
|
||||||
|
if match == "{}" {
|
||||||
|
for idx, item := range items {
|
||||||
|
replacements[idx] = quoteEntry(item.AsString(stripAnsi))
|
||||||
|
}
|
||||||
|
return strings.Join(replacements, " ")
|
||||||
|
}
|
||||||
|
|
||||||
|
tokens := strings.Split(match[1:len(match)-1], ",")
|
||||||
|
ranges := make([]Range, len(tokens))
|
||||||
|
for idx, s := range tokens {
|
||||||
|
r, ok := ParseRange(&s)
|
||||||
|
if !ok {
|
||||||
|
// Invalid expression, just return the original string in the template
|
||||||
|
return match
|
||||||
|
}
|
||||||
|
ranges[idx] = r
|
||||||
|
}
|
||||||
|
|
||||||
|
for idx, item := range items {
|
||||||
|
chars := util.RunesToChars([]rune(item.AsString(stripAnsi)))
|
||||||
|
tokens := Tokenize(chars, delimiter)
|
||||||
|
trans := Transform(tokens, ranges)
|
||||||
|
str := string(joinTokens(trans))
|
||||||
|
if delimiter.str != nil {
|
||||||
|
str = strings.TrimSuffix(str, *delimiter.str)
|
||||||
|
} else if delimiter.regex != nil {
|
||||||
|
delims := delimiter.regex.FindAllStringIndex(str, -1)
|
||||||
|
if len(delims) > 0 && delims[len(delims)-1][1] == len(str) {
|
||||||
|
str = str[:delims[len(delims)-1][0]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str = strings.TrimSpace(str)
|
||||||
|
replacements[idx] = quoteEntry(str)
|
||||||
|
}
|
||||||
|
return strings.Join(replacements, " ")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *Terminal) executeCommand(template string, items []*Item) {
|
||||||
|
command := replacePlaceholder(template, t.ansi, t.delimiter, string(t.input), items)
|
||||||
cmd := util.ExecCommand(command)
|
cmd := util.ExecCommand(command)
|
||||||
cmd.Stdin = os.Stdin
|
cmd.Stdin = os.Stdin
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
@@ -930,8 +993,12 @@ func (t *Terminal) isPreviewEnabled() bool {
|
|||||||
return t.previewBox != nil && t.previewer.enabled
|
return t.previewBox != nil && t.previewer.enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Terminal) currentItem() *Item {
|
||||||
|
return t.merger.Get(t.cy).item
|
||||||
|
}
|
||||||
|
|
||||||
func (t *Terminal) current() string {
|
func (t *Terminal) current() string {
|
||||||
return t.merger.Get(t.cy).item.AsString(t.ansi)
|
return t.currentItem().AsString(t.ansi)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop is called to start Terminal I/O
|
// Loop is called to start Terminal I/O
|
||||||
@@ -988,18 +1055,19 @@ func (t *Terminal) Loop() {
|
|||||||
if t.hasPreviewWindow() {
|
if t.hasPreviewWindow() {
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
request := previewRequest{false, ""}
|
var request *Item
|
||||||
t.previewBox.Wait(func(events *util.Events) {
|
t.previewBox.Wait(func(events *util.Events) {
|
||||||
for req, value := range *events {
|
for req, value := range *events {
|
||||||
switch req {
|
switch req {
|
||||||
case reqPreviewEnqueue:
|
case reqPreviewEnqueue:
|
||||||
request = value.(previewRequest)
|
request = value.(*Item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
events.Clear()
|
events.Clear()
|
||||||
})
|
})
|
||||||
if request.ok {
|
if request != nil {
|
||||||
command := strings.Replace(t.preview.command, "{}", quoteEntry(request.str), -1)
|
command := replacePlaceholder(t.preview.command,
|
||||||
|
t.ansi, t.delimiter, string(t.input), []*Item{request})
|
||||||
cmd := util.ExecCommand(command)
|
cmd := util.ExecCommand(command)
|
||||||
out, _ := cmd.CombinedOutput()
|
out, _ := cmd.CombinedOutput()
|
||||||
t.reqBox.Set(reqPreviewDisplay, string(out))
|
t.reqBox.Set(reqPreviewDisplay, string(out))
|
||||||
@@ -1019,7 +1087,7 @@ func (t *Terminal) Loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
focused := previewRequest{false, ""}
|
var focused *Item
|
||||||
for {
|
for {
|
||||||
t.reqBox.Wait(func(events *util.Events) {
|
t.reqBox.Wait(func(events *util.Events) {
|
||||||
defer events.Clear()
|
defer events.Clear()
|
||||||
@@ -1036,11 +1104,11 @@ func (t *Terminal) Loop() {
|
|||||||
case reqList:
|
case reqList:
|
||||||
t.printList()
|
t.printList()
|
||||||
cnt := t.merger.Length()
|
cnt := t.merger.Length()
|
||||||
var currentFocus previewRequest
|
var currentFocus *Item
|
||||||
if cnt > 0 && cnt > t.cy {
|
if cnt > 0 && cnt > t.cy {
|
||||||
currentFocus = previewRequest{true, t.current()}
|
currentFocus = t.currentItem()
|
||||||
} else {
|
} else {
|
||||||
currentFocus = previewRequest{false, ""}
|
currentFocus = nil
|
||||||
}
|
}
|
||||||
if currentFocus != focused {
|
if currentFocus != focused {
|
||||||
focused = currentFocus
|
focused = currentFocus
|
||||||
@@ -1108,7 +1176,7 @@ func (t *Terminal) Loop() {
|
|||||||
}
|
}
|
||||||
selectItem := func(item *Item) bool {
|
selectItem := func(item *Item) bool {
|
||||||
if _, found := t.selected[item.Index()]; !found {
|
if _, found := t.selected[item.Index()]; !found {
|
||||||
t.selected[item.Index()] = selectedItem{time.Now(), item.AsString(t.ansi)}
|
t.selected[item.Index()] = selectedItem{time.Now(), item}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@@ -1127,7 +1195,7 @@ func (t *Terminal) Loop() {
|
|||||||
}
|
}
|
||||||
scrollPreview := func(amount int) {
|
scrollPreview := func(amount int) {
|
||||||
t.previewer.offset = util.Constrain(
|
t.previewer.offset = util.Constrain(
|
||||||
t.previewer.offset+amount, 0, t.previewer.lines-t.pwindow.Height)
|
t.previewer.offset+amount, 0, t.previewer.lines-1)
|
||||||
req(reqPreviewRefresh)
|
req(reqPreviewRefresh)
|
||||||
}
|
}
|
||||||
for key, ret := range t.expect {
|
for key, ret := range t.expect {
|
||||||
@@ -1145,16 +1213,15 @@ func (t *Terminal) Loop() {
|
|||||||
case actIgnore:
|
case actIgnore:
|
||||||
case actExecute:
|
case actExecute:
|
||||||
if t.cy >= 0 && t.cy < t.merger.Length() {
|
if t.cy >= 0 && t.cy < t.merger.Length() {
|
||||||
item := t.merger.Get(t.cy).item
|
t.executeCommand(t.execmap[mapkey], []*Item{t.currentItem()})
|
||||||
t.executeCommand(t.execmap[mapkey], quoteEntry(item.AsString(t.ansi)))
|
|
||||||
}
|
}
|
||||||
case actExecuteMulti:
|
case actExecuteMulti:
|
||||||
if len(t.selected) > 0 {
|
if len(t.selected) > 0 {
|
||||||
sels := make([]string, len(t.selected))
|
sels := make([]*Item, len(t.selected))
|
||||||
for i, sel := range t.sortSelected() {
|
for i, sel := range t.sortSelected() {
|
||||||
sels[i] = quoteEntry(sel.text)
|
sels[i] = sel.item
|
||||||
}
|
}
|
||||||
t.executeCommand(t.execmap[mapkey], strings.Join(sels, " "))
|
t.executeCommand(t.execmap[mapkey], sels)
|
||||||
} else {
|
} else {
|
||||||
return doAction(actExecute, mapkey)
|
return doAction(actExecute, mapkey)
|
||||||
}
|
}
|
||||||
@@ -1167,7 +1234,7 @@ func (t *Terminal) Loop() {
|
|||||||
t.resizeWindows()
|
t.resizeWindows()
|
||||||
cnt := t.merger.Length()
|
cnt := t.merger.Length()
|
||||||
if t.previewer.enabled && cnt > 0 && cnt > t.cy {
|
if t.previewer.enabled && cnt > 0 && cnt > t.cy {
|
||||||
t.previewBox.Set(reqPreviewEnqueue, previewRequest{true, t.current()})
|
t.previewBox.Set(reqPreviewEnqueue, t.currentItem())
|
||||||
}
|
}
|
||||||
req(reqList, reqInfo)
|
req(reqList, reqInfo)
|
||||||
}
|
}
|
||||||
|
73
src/terminal_test.go
Normal file
73
src/terminal_test.go
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
package fzf
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/junegunn/fzf/src/util"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newItem(str string) *Item {
|
||||||
|
bytes := []byte(str)
|
||||||
|
trimmed, _, _ := extractColor(str, nil, nil)
|
||||||
|
return &Item{origText: &bytes, text: util.RunesToChars([]rune(trimmed))}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestReplacePlaceholder(t *testing.T) {
|
||||||
|
items1 := []*Item{newItem(" foo'bar \x1b[31mbaz\x1b[m")}
|
||||||
|
items2 := []*Item{
|
||||||
|
newItem("foo'bar \x1b[31mbaz\x1b[m"),
|
||||||
|
newItem("FOO'BAR \x1b[31mBAZ\x1b[m")}
|
||||||
|
|
||||||
|
var result string
|
||||||
|
check := func(expected string) {
|
||||||
|
if result != expected {
|
||||||
|
t.Errorf("expected: %s, actual: %s", expected, result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// {}, preserve ansi
|
||||||
|
result = replacePlaceholder("echo {}", false, Delimiter{}, "query", items1)
|
||||||
|
check("echo ' foo'\\''bar \x1b[31mbaz\x1b[m'")
|
||||||
|
|
||||||
|
// {}, strip ansi
|
||||||
|
result = replacePlaceholder("echo {}", true, Delimiter{}, "query", items1)
|
||||||
|
check("echo ' foo'\\''bar baz'")
|
||||||
|
|
||||||
|
// {}, with multiple items
|
||||||
|
result = replacePlaceholder("echo {}", true, Delimiter{}, "query", items2)
|
||||||
|
check("echo 'foo'\\''bar baz' 'FOO'\\''BAR BAZ'")
|
||||||
|
|
||||||
|
// {..}, strip leading whitespaces, preserve ansi
|
||||||
|
result = replacePlaceholder("echo {..}", false, Delimiter{}, "query", items1)
|
||||||
|
check("echo 'foo'\\''bar \x1b[31mbaz\x1b[m'")
|
||||||
|
|
||||||
|
// {..}, strip leading whitespaces, strip ansi
|
||||||
|
result = replacePlaceholder("echo {..}", true, Delimiter{}, "query", items1)
|
||||||
|
check("echo 'foo'\\''bar baz'")
|
||||||
|
|
||||||
|
// {q}
|
||||||
|
result = replacePlaceholder("echo {} {q}", true, Delimiter{}, "query", items1)
|
||||||
|
check("echo ' foo'\\''bar baz' 'query'")
|
||||||
|
|
||||||
|
// {q}, multiple items
|
||||||
|
result = replacePlaceholder("echo {}{q}{}", true, Delimiter{}, "query 'string'", items2)
|
||||||
|
check("echo 'foo'\\''bar baz' 'FOO'\\''BAR BAZ''query '\\''string'\\''''foo'\\''bar baz' 'FOO'\\''BAR BAZ'")
|
||||||
|
|
||||||
|
result = replacePlaceholder("echo {1}/{2}/{2,1}/{-1}/{-2}/{}/{..}/{n.t}/\\{}/\\{1}/\\{q}/{3}", true, Delimiter{}, "query", items1)
|
||||||
|
check("echo 'foo'\\''bar'/'baz'/'bazfoo'\\''bar'/'baz'/'foo'\\''bar'/' foo'\\''bar baz'/'foo'\\''bar baz'/{n.t}/{}/{1}/{q}/''")
|
||||||
|
|
||||||
|
result = replacePlaceholder("echo {1}/{2}/{-1}/{-2}/{..}/{n.t}/\\{}/\\{1}/\\{q}/{3}", true, Delimiter{}, "query", items2)
|
||||||
|
check("echo 'foo'\\''bar' 'FOO'\\''BAR'/'baz' 'BAZ'/'baz' 'BAZ'/'foo'\\''bar' 'FOO'\\''BAR'/'foo'\\''bar baz' 'FOO'\\''BAR BAZ'/{n.t}/{}/{1}/{q}/'' ''")
|
||||||
|
|
||||||
|
// String delimiter
|
||||||
|
delim := "'"
|
||||||
|
result = replacePlaceholder("echo {}/{1}/{2}", true, Delimiter{str: &delim}, "query", items1)
|
||||||
|
check("echo ' foo'\\''bar baz'/'foo'/'bar baz'")
|
||||||
|
|
||||||
|
// Regex delimiter
|
||||||
|
regex := regexp.MustCompile("[oa]+")
|
||||||
|
// foo'bar baz
|
||||||
|
result = replacePlaceholder("echo {}/{1}/{3}/{2..3}", true, Delimiter{regex: regex}, "query", items1)
|
||||||
|
check("echo ' foo'\\''bar baz'/'f'/'r b'/''\\''bar b'")
|
||||||
|
}
|
@@ -1,6 +1,7 @@
|
|||||||
package util
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"unicode"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ func (chars *Chars) TrimLength() int {
|
|||||||
len := chars.Length()
|
len := chars.Length()
|
||||||
for i = len - 1; i >= 0; i-- {
|
for i = len - 1; i >= 0; i-- {
|
||||||
char := chars.Get(i)
|
char := chars.Get(i)
|
||||||
if char != ' ' && char != '\t' {
|
if !unicode.IsSpace(char) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,7 +76,7 @@ func (chars *Chars) TrimLength() int {
|
|||||||
var j int
|
var j int
|
||||||
for j = 0; j < len; j++ {
|
for j = 0; j < len; j++ {
|
||||||
char := chars.Get(j)
|
char := chars.Get(j)
|
||||||
if char != ' ' && char != '\t' {
|
if !unicode.IsSpace(char) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,7 +87,7 @@ func (chars *Chars) TrailingWhitespaces() int {
|
|||||||
whitespaces := 0
|
whitespaces := 0
|
||||||
for i := chars.Length() - 1; i >= 0; i-- {
|
for i := chars.Length() - 1; i >= 0; i-- {
|
||||||
char := chars.Get(i)
|
char := chars.Get(i)
|
||||||
if char != ' ' && char != '\t' {
|
if !unicode.IsSpace(char) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
whitespaces++
|
whitespaces++
|
||||||
|
@@ -143,6 +143,10 @@ Execute (fzf#wrap):
|
|||||||
Assert opts.options =~ '--history /tmp/foobar'
|
Assert opts.options =~ '--history /tmp/foobar'
|
||||||
Assert opts.options =~ '--color light'
|
Assert opts.options =~ '--color light'
|
||||||
|
|
||||||
|
let g:fzf_colors = { 'fg': ['fg', 'Error'] }
|
||||||
|
let opts = fzf#wrap({})
|
||||||
|
Assert opts.options =~ '^--color=fg:'
|
||||||
|
|
||||||
Execute (Cleanup):
|
Execute (Cleanup):
|
||||||
unlet g:dir
|
unlet g:dir
|
||||||
Restore
|
Restore
|
||||||
|
@@ -136,8 +136,10 @@ class Tmux
|
|||||||
def prepare
|
def prepare
|
||||||
tries = 0
|
tries = 0
|
||||||
begin
|
begin
|
||||||
self.send_keys 'C-u', 'hello', 'Right'
|
self.until do |lines|
|
||||||
self.until { |lines| lines[-1].end_with?('hello') }
|
self.send_keys 'C-u', 'hello'
|
||||||
|
lines[-1].end_with?('hello')
|
||||||
|
end
|
||||||
rescue Exception
|
rescue Exception
|
||||||
(tries += 1) < 5 ? retry : raise
|
(tries += 1) < 5 ? retry : raise
|
||||||
end
|
end
|
||||||
@@ -604,8 +606,8 @@ class TestGoFZF < TestBase
|
|||||||
], `#{FZF} -fo --tiebreak=end < #{tempname}`.split($/)
|
], `#{FZF} -fo --tiebreak=end < #{tempname}`.split($/)
|
||||||
|
|
||||||
assert_equal [
|
assert_equal [
|
||||||
' xxxxoxxx',
|
|
||||||
'xxxxxoxxx',
|
'xxxxxoxxx',
|
||||||
|
' xxxxoxxx',
|
||||||
'xxxxoxxxx',
|
'xxxxoxxxx',
|
||||||
'xxxoxxxxxx',
|
'xxxoxxxxxx',
|
||||||
'xxoxxxxxxx',
|
'xxoxxxxxxx',
|
||||||
|
Reference in New Issue
Block a user