@@ -198,7 +198,8 @@ endfunction
198
198
" @param {number} args.col 0-based indexing
199
199
" @param {number} args.width
200
200
" @param {number} args.height
201
- " @param {boolean?} args.border
201
+ " @param {boolean|[string]?} args.border - boolean, or list of characters
202
+ " clockwise from top-left (same as nvim_open_win() in neovim)
202
203
" @param {number?} args.topline
203
204
" @param {string?} args.origin - topleft/topright/botleft/botright
204
205
"
@@ -450,11 +451,14 @@ endfunction
450
451
451
452
if has (' nvim' )
452
453
function ! s: _resolve_border (style) abort
453
- if ! empty (get (a: style , ' border' , v: null ))
454
- if &ambiwidth == # ' single'
455
- let a: style .border = [' ┌' , ' ─' , ' ┐' , ' │' , ' ┘' , ' ─' , ' └' , ' │' ]
456
- else
457
- let a: style .border = [' +' , ' -' , ' +' , ' |' , ' +' , ' -' , ' +' , ' |' ]
454
+ let l: border = get (a: style , ' border' , v: null )
455
+ if ! empty (l: border )
456
+ if type (l: border ) != type ([])
457
+ if &ambiwidth == # ' single'
458
+ let a: style .border = [' ┌' , ' ─' , ' ┐' , ' │' , ' ┘' , ' ─' , ' └' , ' │' ]
459
+ else
460
+ let a: style .border = [' +' , ' -' , ' +' , ' |' , ' +' , ' -' , ' +' , ' |' ]
461
+ endif
458
462
endif
459
463
elseif has_key (a: style , ' border' )
460
464
unlet a: style .border
@@ -463,11 +467,28 @@ if has('nvim')
463
467
endfunction
464
468
else
465
469
function ! s: _resolve_border (style) abort
470
+ let l: border = get (a: style , ' border' , v: null )
466
471
if ! empty (get (a: style , ' border' , v: null ))
467
- if &ambiwidth == # ' single'
468
- let a: style .border = [' ─' , ' │' , ' ─' , ' │' , ' ┌' , ' ┐' , ' ┘' , ' └' ]
472
+ if type (l: border ) != type ([])
473
+ if &ambiwidth == # ' single'
474
+ let a: style .border = [' ─' , ' │' , ' ─' , ' │' , ' ┌' , ' ┐' , ' ┘' , ' └' ]
475
+ else
476
+ let a: style .border = [' -' , ' |' , ' -' , ' |' , ' +' , ' +' , ' +' , ' +' ]
477
+ endif
469
478
else
470
- let a: style .border = [' -' , ' |' , ' -' , ' |' , ' +' , ' +' , ' +' , ' +' ]
479
+ " Emulate nvim behavior for lists of 1/2/4 elements
480
+ let l: topleft = l: border [0 ]
481
+ let l: top = get (l: border , 1 , l: topleft )
482
+ let l: topright = get (l: border , 2 , l: topleft )
483
+ let l: right = get (l: border , 3 , l: top )
484
+ let l: bottomright = get (l: border , 4 , l: topleft )
485
+ let l: bottom = get (l: border , 5 , l: top )
486
+ let l: bottomleft = get (l: border , 6 , l: topright )
487
+ let l: left = get (l: border , 7 , l: right )
488
+ let a: style .border = [
489
+ \ l: top , l: right , l: bottom , l: left ,
490
+ \ l: topleft , l: topright , l: bottomright , l: bottomleft ,
491
+ \ ]
471
492
endif
472
493
elseif has_key (a: style , ' border' )
473
494
unlet a: style .border
0 commit comments