junegunn / goyo.vim

:tulip: Distraction-free writing in Vim
MIT License
4.53k stars 116 forks source link

Airline Tabline Redraw Bug? #63

Closed starcraftman closed 9 years ago

starcraftman commented 9 years ago

I'm not sure who is responsible but only manifests after Goyo command, may require upstream fix in airline or even a vim redraw bug?

Test: Use :Goyo twice, then you'll see a graphical bug on separators of the tabline. I.e. where the > separates colors. Then put hack into config & it won't reproduce.

Test config to reproduce:

let g:win_shell = (has('win32') || has('win64')) && &shellcmdflag =~ '/'
let g:cygwin_shell = has('win32unix')
let g:vim_dir = g:win_shell ? '$HOME/vimfiles' : '$HOME/.vim'

try
  call plug#begin(expand(g:vim_dir . '/bundle'))

  Plug 'bling/vim-airline'
  Plug 'junegunn/goyo.vim'
  Plug 'tomasr/molokai'

  call plug#end()
catch
  echomsg 'Run command `Bootstrap`. After restart run command `pi'
endtry

let g:airline#extensions#syntastic#enabled = 1

let g:airline#extensions#tabline#enabled = 1

let g:airline_powerline_fonts = 1

let &statusline  = '%<%1* %t%m %y || %{&fenc?&fenc:&enc}[%{&ff}] ' 
let &statusline .= '%= %b(0x%B) || buf: %n || %p%% %l,%c %0*'
set laststatus=2

syntax off
set background=dark
colorscheme molokai
syntax on

Hack that resolves problem:

function s:goyo_leave()
  split
  redraw
  quit
endfunction

autocmd! User GoyoLeave
autocmd  User GoyoLeave nested call <SID>goyo_leave()
starcraftman commented 9 years ago

Picture of problem: tab

junegunn commented 9 years ago

I don't use airline, so, can you check if the problem is reproducible without Goyo? Goyo toggles airline with the following code:

starcraftman commented 9 years ago

@junegunn I did think of that during my own debugging. Without goyo.vim the AirlineToggle command redraws fine. I've noticed previously that sometimes airline doesn't handle resizes well, especially horizontal squashes. I can't be certain though it isn't something here. Even if it is upstream, my little solution may be useful to other airliners. Will try to investigate further.