[vim] Use system-default border style

* 'rounded' on non-Windows platforms
* 'sharp' on Windows
This commit is contained in:
Junegunn Choi 2023-01-16 22:44:22 +09:00
parent dc8da605f9
commit a6d6cdd165
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
3 changed files with 10 additions and 7 deletions

View File

@ -312,7 +312,7 @@ following options are allowed:
- `yoffset` [float default 0.5 range [0 ~ 1]] - `yoffset` [float default 0.5 range [0 ~ 1]]
- `xoffset` [float default 0.5 range [0 ~ 1]] - `xoffset` [float default 0.5 range [0 ~ 1]]
- `relative` [boolean default v:false] - `relative` [boolean default v:false]
- `border` [string default `rounded`]: Border style - `border` [string default `rounded` (`sharp` on Windows)]: Border style
- `rounded` / `sharp` / `horizontal` / `vertical` / `top` / `bottom` / `left` / `right` / `no[ne]` - `rounded` / `sharp` / `horizontal` / `vertical` / `top` / `bottom` / `left` / `right` / `no[ne]`
`fzf#wrap` `fzf#wrap`

View File

@ -325,7 +325,7 @@ following options are allowed:
- `yoffset` [float default 0.5 range [0 ~ 1]] - `yoffset` [float default 0.5 range [0 ~ 1]]
- `xoffset` [float default 0.5 range [0 ~ 1]] - `xoffset` [float default 0.5 range [0 ~ 1]]
- `relative` [boolean default v:false] - `relative` [boolean default v:false]
- `border` [string default `rounded`]: Border style - `border` [string default `rounded` (`sharp` on Windows)]: Border style
- `rounded` / `sharp` / `horizontal` / `vertical` / `top` / `bottom` / `left` / `right` / `no[ne]` - `rounded` / `sharp` / `horizontal` / `vertical` / `top` / `bottom` / `left` / `right` / `no[ne]`

View File

@ -511,7 +511,10 @@ try
let height = s:calc_size(&lines, dict.down, dict) let height = s:calc_size(&lines, dict.down, dict)
let optstr .= ' --height='.height let optstr .= ' --height='.height
endif endif
let optstr .= s:border_opt(get(dict, 'window', 0)) " Respect --border option given in 'options'
if stridx(optstr, '--border') < 0 && stridx(optstr, '--no-border') < 0
let optstr .= s:border_opt(get(dict, 'window', 0))
endif
let prev_default_command = $FZF_DEFAULT_COMMAND let prev_default_command = $FZF_DEFAULT_COMMAND
if len(source_command) if len(source_command)
let $FZF_DEFAULT_COMMAND = source_command let $FZF_DEFAULT_COMMAND = source_command
@ -755,9 +758,9 @@ function! s:border_opt(window)
endif endif
" Border style " Border style
let style = tolower(get(a:window, 'border', 'rounded')) let style = tolower(get(a:window, 'border', ''))
if !has_key(a:window, 'border') && !get(a:window, 'rounded', 1) if !has_key(a:window, 'border') && has_key(a:window, 'rounded')
let style = 'sharp' let style = a:window.rounded ? 'rounded' : 'sharp'
endif endif
if style == 'none' || style == 'no' if style == 'none' || style == 'no'
return '' return ''
@ -765,7 +768,7 @@ function! s:border_opt(window)
" For --border styles, we need fzf 0.24.0 or above " For --border styles, we need fzf 0.24.0 or above
call fzf#exec('0.24.0') call fzf#exec('0.24.0')
let opt = ' --border=' . style let opt = ' --border ' . style
if has_key(a:window, 'highlight') if has_key(a:window, 'highlight')
let color = s:get_color('fg', a:window.highlight) let color = s:get_color('fg', a:window.highlight)
if len(color) if len(color)