Skip to content
Snippets Groups Projects
Unverified Commit 0db65c22 authored by Junegunn Choi's avatar Junegunn Choi
Browse files

[vim] Allow specifying popup width and height in absolute integer value

parent d7851356
No related branches found
No related tags found
No related merge requests found
......@@ -290,8 +290,8 @@ When `window` entry is a dictionary, fzf will start in a popup window. The
following options are allowed:
- Required:
- `width` [float range [0 ~ 1]]
- `height` [float range [0 ~ 1]]
- `width` [float range [0 ~ 1]] or [integer range [8 ~ ]]
- `height` [float range [0 ~ 1]] or [integer range [4 ~ ]]
- Optional:
- `yoffset` [float default 0.5 range [0 ~ 1]]
- `xoffset` [float default 0.5 range [0 ~ 1]]
......@@ -386,8 +386,8 @@ The latest versions of Vim and Neovim include builtin terminal emulator
```vim
" Required:
" - width [float range [0 ~ 1]]
" - height [float range [0 ~ 1]]
" - width [float range [0 ~ 1]] or [integer range [8 ~ ]]
" - height [float range [0 ~ 1]] or [integer range [4 ~ ]]
"
" Optional:
" - xoffset [float default 0.5 range [0 ~ 1]]
......
......@@ -305,8 +305,8 @@ When `window` entry is a dictionary, fzf will start in a popup window. The
following options are allowed:
- Required:
- `width` [float range [0 ~ 1]]
- `height` [float range [0 ~ 1]]
- `width` [float range [0 ~ 1]] or [integer range [8 ~ ]]
- `height` [float range [0 ~ 1]] or [integer range [4 ~ ]]
- Optional:
- `yoffset` [float default 0.5 range [0 ~ 1]]
- `xoffset` [float default 0.5 range [0 ~ 1]]
......
......@@ -864,9 +864,9 @@ function! s:popup(opts) abort
let ambidouble = &ambiwidth == 'double' ? 2 : 1
" Size and position
let width = min([max([0, float2nr(&columns * a:opts.width)]), &columns])
let width = min([max([8, a:opts.width > 1 ? a:opts.width : float2nr(&columns * a:opts.width)]), &columns])
let width += width % ambidouble
let height = min([max([0, float2nr(&lines * a:opts.height)]), &lines - has('nvim')])
let height = min([max([4, a:opts.height > 1 ? a:opts.height : float2nr(&lines * a:opts.height)]), &lines - has('nvim')])
let row = float2nr(get(a:opts, 'yoffset', 0.5) * (&lines - height))
let col = float2nr(get(a:opts, 'xoffset', 0.5) * (&columns - width))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment