Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Width becomes wrong from fullscreen mode in linux #43

Closed
lervag opened this issue Sep 16, 2014 · 10 comments
Closed

Width becomes wrong from fullscreen mode in linux #43

lervag opened this issue Sep 16, 2014 · 10 comments

Comments

@lervag
Copy link

lervag commented Sep 16, 2014

If I open gvim, go to fullscreen mode, issue :Goyo, then the window with becomes much less than the default 80. If I instead issue :Goyo before I go to fullscreen mode, then it works as expected.

My vimrc settings are:

let g:goyo_margin_top = 0
let g:goyo_margin_bottom = 0
map <F8> :Goyo<cr>

function! s:goyo_enter()
  let b:quitting = 0
  let b:quitting_bang = 0
  autocmd QuitPre <buffer> let b:quitting = 1
  cabbrev <buffer> q! let b:quitting_bang = 1 <bar> q!
endfunction
function! s:goyo_leave()
  if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
    if b:quitting_bang
      qa!
    else
      qa
    endif
  endif
endfunction

autocmd! User GoyoEnter
autocmd  User GoyoEnter call <SID>goyo_enter()
autocmd! User GoyoLeave
autocmd  User GoyoLeave call <SID>goyo_leave()

Note that the current workaround works (although it should not be necessary):

autocmd User GoyoEnter Goyo 80
@junegunn
Copy link
Owner

Thanks for the report. I currently don't have access to a linux desktop, I will check when I get a chance. (From what I can tell it's not reproducible on MacVim.)

@lervag
Copy link
Author

lervag commented Sep 16, 2014

I'm not surprised if it is not reproducible on MacVim, which even allows to set fullscreen mode from inside vim. In any case, let me know if there is anything I can do to help.

@junegunn
Copy link
Owner

Which distro are you running?

@lervag
Copy link
Author

lervag commented Sep 16, 2014

I'm on Arch linux and I use xfce4.
16. sep. 2014 16:28 skrev "Junegunn Choi" notifications@github.com
følgende:

Which distro are you running?


Reply to this email directly or view it on GitHub
#43 (comment).

@junegunn
Copy link
Owner

I managed to set up an Arch VM with xfce4, but I couldn't reproduce the problem. (However, I ran into a different problem where "height" instead of width shrinks by a few lines. But it seemed like a bug of GVim itself, as it was easily reproducible with tab split without Goyo)

Could you try it without any other plugins and settings?

gvim -Nu <(echo 'set rtp+=~/.vim/bundle/goyo.vim')

@lervag
Copy link
Author

lervag commented Sep 20, 2014

Ah, I'm very sorry, I should of course have tested a minimal example first. I should at the very least have tested the example I described initially!

My problem is due to the use of a different plugin vim-fontsize that I use inside the goyo_enter function to increase the font size. I do not understand why the problem occur. I'll investigate further on my own, and in the inprobable case that there is something wrong with Goyo I'll reopen the issue.

@lervag lervag closed this as completed Sep 20, 2014
@lervag
Copy link
Author

lervag commented Sep 20, 2014

Ok, so I managed to find a simple example that fails without using external plugins. Personally I use the Inconsolata-g\ Medium font, but since you might use other fonts I chose to let you choose the font yourself. In any case, if you use the following goyo_enter function where the font size is increased with set guifont, the problem should be reproducible.

function! s:goyo_enter()
  set guifont=<selected font> 11
endfunction

@junegunn
Copy link
Owner

What happens when you add nested to the autocmd statements like so? Does it help?

autocmd  User GoyoEnter nested call <SID>goyo_enter()
autocmd  User GoyoLeave nested call <SID>goyo_leave()

Goyo re-adjusts the sizes of the windows on VimResized event which should be invoked on set guifont.

@junegunn
Copy link
Owner

I recently updated README page to encourage the use of nested flag.

9eadf29

@lervag
Copy link
Author

lervag commented Sep 21, 2014

Yes, with nested the issue is solved. Thanks!

ashrasmun added a commit to ashrasmun/mcass that referenced this issue Jan 28, 2020
I don't know how exactly does it fix the problem, but I saw it on
junegunn/goyo.vim#43 and somehow it fixes
my problem too :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants