Skip to content
Myr

[vim] Consider ambiwidth for border (#1861)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Close #1856 Close #1857

authored by Kyoichiro Yamada · committed by GitHub · parent 02c5e62 · Browse files · 1 file+7 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−3 removed

  • other:+7 added−3 removed

1 file+7 added−3 removed

modified:plugin/fzf.vim+7 added-3 removed
840 unmodified lines
841 endfunction842endif843844function! s:popup(opts) abort845 " Support ambiwidth == 'double'846 let ambidouble = &ambiwidth == 'double' ? 2 : 1847848 " Size and position849 let width = min([max([0, float2nr(&columns * a:opts.width)]), &columns])850 let width += width % ambidouble851 let height = min([max([0, float2nr(&lines * a:opts.height)]), &lines - has('nvim')])852 let row = float2nr(get(a:opts, 'yoffset', 0.5) * (&lines - height))853 let col = float2nr(get(a:opts, 'xoffset', 0.5) * (&columns - width))854
9 unmodified lines
864 let style = 'sharp'865 endif866867 if style == 'horizontal'864 let hor = repeat('─', width)868 let hor = repeat('─', width / ambidouble)869 let mid = repeat(' ', width)870 let border = [hor] + repeat([mid], height - 2) + [hor]871 let margin = 0872 else873 let edges = style == 'sharp' ? ['┌', '┐', '└', '┘'] : ['╭', '╮', '╰', '╯']870 let bar = repeat('─', width - 2)874 let bar = repeat('─', width / ambidouble - 2)875 let top = edges[0] .. bar .. edges[1]872 let mid = '│' .. repeat(' ', width - 2) .. '│'876 let mid = '│' .. repeat(' ', width - 2 * ambidouble) .. '│'877 let bot = edges[2] .. bar .. edges[3]878 let border = [top] + repeat([mid], height - 2) + [bot]879 let margin = 2880 endif
49 unmodified lines