|
| 1 | +function! fall#internal#msgarea#hide() abort |
| 2 | + call s:hide_msgarea() |
| 3 | + redraw |
| 4 | +endfunction |
| 5 | + |
| 6 | +function! fall#internal#msgarea#show() abort |
| 7 | + call s:show_msgarea() |
| 8 | + redraw |
| 9 | +endfunction |
| 10 | + |
| 11 | +if has('nvim') |
| 12 | + function! s:hide_msgarea() abort |
| 13 | + if exists('s:hl_msgarea') |
| 14 | + return |
| 15 | + endif |
| 16 | + let s:hl_msgarea = nvim_get_hl(0, #{ name: 'MsgArea' }) |
| 17 | + let l:hl_normal = nvim_get_hl(0, #{ name: 'Normal' }) |
| 18 | + if !has_key(l:hl_normal, 'bg') |
| 19 | + " guifg=NONE is not supported |
| 20 | + unlet! s:hl_msgarea |
| 21 | + return |
| 22 | + endif |
| 23 | + call nvim_set_hl(0, 'MsgArea', #{ fg: l:hl_normal.bg, bg: l:hl_normal.bg }) |
| 24 | + endfunction |
| 25 | + |
| 26 | + function! s:show_msgarea() abort |
| 27 | + if !exists('s:hl_msgarea') |
| 28 | + return |
| 29 | + endif |
| 30 | + call nvim_set_hl(0, 'MsgArea', s:hl_msgarea) |
| 31 | + unlet s:hl_msgarea |
| 32 | + endfunction |
| 33 | +else |
| 34 | + function! s:hide_msgarea() abort |
| 35 | + if exists('s:hl_msgarea') |
| 36 | + return |
| 37 | + endif |
| 38 | + let s:hl_msgarea = hlget('MsgArea') |
| 39 | + let l:hl_normal = hlget('Normal') |
| 40 | + if !has_key(l:hl_normal[0], 'guibg') |
| 41 | + " guifg=NONE is not supported |
| 42 | + unlet! s:hl_msgarea |
| 43 | + return |
| 44 | + endif |
| 45 | + call hlset([#{ name: 'MsgArea', guifg: l:hl_normal[0].guibg, guibg: l:hl_normal[0].guibg }]) |
| 46 | + endfunction |
| 47 | + |
| 48 | + function! s:show_msgarea() abort |
| 49 | + if !exists('s:hl_msgarea') |
| 50 | + return |
| 51 | + endif |
| 52 | + call hlset([extend(#{ force: 1 }, s:hl_msgarea[0])]) |
| 53 | + unlet s:hl_msgarea |
| 54 | + endfunction |
| 55 | +endif |
0 commit comments