diff options
author | Kyoichiro Yamada <me@kyoh86.dev> | 2020-02-10 17:52:15 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-10 17:52:15 +0900 |
commit | 001d1168848c0d799e69f4172eaeb79cce9f36c0 (patch) | |
tree | 12d9df8d29dc819c2c975f76c39be1c8fef4f276 /plugin | |
parent | 02c5e62efeda372ff918eb72fec3c1d2829275b3 (diff) |
[vim] Consider ambiwidth for border (#1861)
Close #1856
Close #1857
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/fzf.vim | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 7e3046af..b024c92a 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -842,8 +842,12 @@ else endif function! s:popup(opts) abort + " Support ambiwidth == 'double' + let ambidouble = &ambiwidth == 'double' ? 2 : 1 + " Size and position let width = min([max([0, float2nr(&columns * a:opts.width)]), &columns]) + let width += width % ambidouble let height = min([max([0, 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)) @@ -861,15 +865,15 @@ function! s:popup(opts) abort endif if style == 'horizontal' - let hor = repeat('─', width) + let hor = repeat('─', width / ambidouble) let mid = repeat(' ', width) let border = [hor] + repeat([mid], height - 2) + [hor] let margin = 0 else let edges = style == 'sharp' ? ['┌', '┐', '└', '┘'] : ['╭', '╮', '╰', '╯'] - let bar = repeat('─', width - 2) + let bar = repeat('─', width / ambidouble - 2) let top = edges[0] .. bar .. edges[1] - let mid = '│' .. repeat(' ', width - 2) .. '│' + let mid = '│' .. repeat(' ', width - 2 * ambidouble) .. '│' let bot = edges[2] .. bar .. edges[3] let border = [top] + repeat([mid], height - 2) + [bot] let margin = 2 |