mirror of
https://github.com/junegunn/fzf.git
synced 2026-04-27 01:40:34 +08:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f70cc6738d | |||
| dacb87abca | |||
| abfa60b7d0 | |||
| 12199823ab | |||
| 2c459ffdff | |||
| f80ba22ab9 | |||
| 4cd97ba35b | |||
| 332382e5e7 | |||
| 987c37cb2d | |||
| 9deb7c5489 | |||
| 5352b88c5a |
@@ -28,7 +28,7 @@ jobs:
|
|||||||
go-version: "1.23"
|
go-version: "1.23"
|
||||||
|
|
||||||
- name: Setup Ruby
|
- name: Setup Ruby
|
||||||
uses: ruby/setup-ruby@7372622e62b60b3cb750dcd2b9e32c247ffec26a # v1
|
uses: ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1
|
||||||
with:
|
with:
|
||||||
ruby-version: 3.4.6
|
ruby-version: 3.4.6
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ jobs:
|
|||||||
go-version: "1.23"
|
go-version: "1.23"
|
||||||
|
|
||||||
- name: Setup Ruby
|
- name: Setup Ruby
|
||||||
uses: ruby/setup-ruby@7372622e62b60b3cb750dcd2b9e32c247ffec26a # v1
|
uses: ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1
|
||||||
with:
|
with:
|
||||||
ruby-version: 3.0.0
|
ruby-version: 3.0.0
|
||||||
|
|
||||||
|
|||||||
+1
-6
@@ -15,12 +15,7 @@ CHANGELOG
|
|||||||
```
|
```
|
||||||
- `--header-label` and `--footer-label` render on their respective separator row.
|
- `--header-label` and `--footer-label` render on their respective separator row.
|
||||||
- The separator inherits `--color list-border` when the section's own border color is not explicitly set.
|
- The separator inherits `--color list-border` when the section's own border color is not explicitly set.
|
||||||
- `inline` takes precedence over `--header-first`: the inline section stays inside the list frame. `--header-border=inline` requires `--header-lines-border` to be `inline` or unset.
|
- `--header-first` is not compatible with `--header-border=inline` or `--header-lines-border=inline`; `--header-border=inline` requires `--header-lines-border` to be `inline` or unset.
|
||||||
- [vim] Move and resize popup window when detecting `VimResized` event (#4778) (@Vulcalien)
|
|
||||||
- Bug fixes
|
|
||||||
- Fixed gutter display in `--style=minimal`
|
|
||||||
- Fixed arrow keys / Home / End without modifiers being ignored under the kitty keyboard protocol (#4776) (@TymekDev)
|
|
||||||
- bash: Persist history deletion when `histappend` is on (#4764)
|
|
||||||
|
|
||||||
0.71.0
|
0.71.0
|
||||||
------
|
------
|
||||||
|
|||||||
+25
-57
@@ -896,7 +896,6 @@ function! s:execute_term(dict, command, temps) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
function! fzf.on_exit(id, code, ...)
|
function! fzf.on_exit(id, code, ...)
|
||||||
silent! autocmd! fzf_popup_resize
|
|
||||||
if s:getpos() == self.ppos " {'window': 'enew'}
|
if s:getpos() == self.ppos " {'window': 'enew'}
|
||||||
for [opt, val] in items(self.winopts)
|
for [opt, val] in items(self.winopts)
|
||||||
execute 'let' opt '=' val
|
execute 'let' opt '=' val
|
||||||
@@ -1024,17 +1023,15 @@ function! s:callback(dict, lines) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
if has('nvim')
|
if has('nvim')
|
||||||
function! s:create_popup() abort
|
function s:create_popup(opts) abort
|
||||||
let opts = s:popup_bounds()
|
|
||||||
let opts = extend({'relative': 'editor', 'style': 'minimal'}, opts)
|
|
||||||
|
|
||||||
let buf = nvim_create_buf(v:false, v:true)
|
let buf = nvim_create_buf(v:false, v:true)
|
||||||
let s:popup_id = nvim_open_win(buf, v:true, opts)
|
let opts = extend({'relative': 'editor', 'style': 'minimal'}, a:opts)
|
||||||
call setwinvar(s:popup_id, '&colorcolumn', '')
|
let win = nvim_open_win(buf, v:true, opts)
|
||||||
|
call setwinvar(win, '&colorcolumn', '')
|
||||||
|
|
||||||
" Colors
|
" Colors
|
||||||
try
|
try
|
||||||
call setwinvar(s:popup_id, '&winhighlight', 'Pmenu:,Normal:Normal')
|
call setwinvar(win, '&winhighlight', 'Pmenu:,Normal:Normal')
|
||||||
let rules = get(g:, 'fzf_colors', {})
|
let rules = get(g:, 'fzf_colors', {})
|
||||||
if has_key(rules, 'bg')
|
if has_key(rules, 'bg')
|
||||||
let color = call('s:get_color', rules.bg)
|
let color = call('s:get_color', rules.bg)
|
||||||
@@ -1042,61 +1039,40 @@ if has('nvim')
|
|||||||
let ns = nvim_create_namespace('fzf_popup')
|
let ns = nvim_create_namespace('fzf_popup')
|
||||||
let hl = nvim_set_hl(ns, 'Normal',
|
let hl = nvim_set_hl(ns, 'Normal',
|
||||||
\ &termguicolors ? { 'bg': color } : { 'ctermbg': str2nr(color) })
|
\ &termguicolors ? { 'bg': color } : { 'ctermbg': str2nr(color) })
|
||||||
call nvim_win_set_hl_ns(s:popup_id, ns)
|
call nvim_win_set_hl_ns(win, ns)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
catch
|
catch
|
||||||
endtry
|
endtry
|
||||||
return buf
|
return buf
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:resize_popup() abort
|
|
||||||
if !exists('s:popup_id') || !nvim_win_is_valid(s:popup_id)
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
let opts = s:popup_bounds()
|
|
||||||
let opts = extend({'relative': 'editor'}, opts)
|
|
||||||
call nvim_win_set_config(s:popup_id, opts)
|
|
||||||
endfunction
|
|
||||||
else
|
else
|
||||||
function! s:create_popup() abort
|
function! s:create_popup(opts) abort
|
||||||
function! s:popup_create(buf)
|
let s:popup_create = {buf -> popup_create(buf, #{
|
||||||
let s:popup_id = popup_create(a:buf, #{zindex: 1000})
|
\ line: a:opts.row,
|
||||||
call s:resize_popup()
|
\ col: a:opts.col,
|
||||||
endfunction
|
\ minwidth: a:opts.width,
|
||||||
|
\ maxwidth: a:opts.width,
|
||||||
|
\ minheight: a:opts.height,
|
||||||
|
\ maxheight: a:opts.height,
|
||||||
|
\ zindex: 1000,
|
||||||
|
\ })}
|
||||||
autocmd TerminalOpen * ++once call s:popup_create(str2nr(expand('<abuf>')))
|
autocmd TerminalOpen * ++once call s:popup_create(str2nr(expand('<abuf>')))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:resize_popup() abort
|
|
||||||
if !exists('s:popup_id') || empty(popup_getpos(s:popup_id))
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
let opts = s:popup_bounds()
|
|
||||||
call popup_move(s:popup_id, {
|
|
||||||
\ 'line': opts.row,
|
|
||||||
\ 'col': opts.col,
|
|
||||||
\ 'minwidth': opts.width,
|
|
||||||
\ 'maxwidth': opts.width,
|
|
||||||
\ 'minheight': opts.height,
|
|
||||||
\ 'maxheight': opts.height,
|
|
||||||
\ })
|
|
||||||
endfunction
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
function! s:popup_bounds() abort
|
function! s:popup(opts) abort
|
||||||
let opts = s:popup_opts
|
let xoffset = get(a:opts, 'xoffset', 0.5)
|
||||||
|
let yoffset = get(a:opts, 'yoffset', 0.5)
|
||||||
let xoffset = get(opts, 'xoffset', 0.5)
|
let relative = get(a:opts, 'relative', 0)
|
||||||
let yoffset = get(opts, 'yoffset', 0.5)
|
|
||||||
let relative = get(opts, 'relative', 0)
|
|
||||||
|
|
||||||
" Use current window size for positioning relatively positioned popups
|
" Use current window size for positioning relatively positioned popups
|
||||||
let columns = relative ? winwidth(0) : &columns
|
let columns = relative ? winwidth(0) : &columns
|
||||||
let lines = relative ? winheight(0) : (&lines - has('nvim'))
|
let lines = relative ? winheight(0) : (&lines - has('nvim'))
|
||||||
|
|
||||||
" Size and position
|
" Size and position
|
||||||
let width = min([max([8, opts.width > 1 ? opts.width : float2nr(columns * opts.width)]), columns])
|
let width = min([max([8, a:opts.width > 1 ? a:opts.width : float2nr(columns * a:opts.width)]), columns])
|
||||||
let height = min([max([4, opts.height > 1 ? opts.height : float2nr(lines * opts.height)]), lines])
|
let height = min([max([4, a:opts.height > 1 ? a:opts.height : float2nr(lines * a:opts.height)]), lines])
|
||||||
let row = float2nr(yoffset * (lines - height)) + (relative ? win_screenpos(0)[0] - 1 : 0)
|
let row = float2nr(yoffset * (lines - height)) + (relative ? win_screenpos(0)[0] - 1 : 0)
|
||||||
let col = float2nr(xoffset * (columns - width)) + (relative ? win_screenpos(0)[1] - 1 : 0)
|
let col = float2nr(xoffset * (columns - width)) + (relative ? win_screenpos(0)[1] - 1 : 0)
|
||||||
|
|
||||||
@@ -1106,17 +1082,9 @@ function! s:popup_bounds() abort
|
|||||||
let row += !has('nvim')
|
let row += !has('nvim')
|
||||||
let col += !has('nvim')
|
let col += !has('nvim')
|
||||||
|
|
||||||
return { 'row': row, 'col': col, 'width': width, 'height': height }
|
call s:create_popup({
|
||||||
endfunction
|
\ 'row': row, 'col': col, 'width': width, 'height': height
|
||||||
|
\ })
|
||||||
function! s:popup(opts) abort
|
|
||||||
let s:popup_opts = a:opts
|
|
||||||
call s:create_popup()
|
|
||||||
|
|
||||||
augroup fzf_popup_resize
|
|
||||||
autocmd!
|
|
||||||
autocmd VimResized * call s:resize_popup()
|
|
||||||
augroup END
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:default_action = {
|
let s:default_action = {
|
||||||
|
|||||||
Reference in New Issue
Block a user