firenvim icon indicating copy to clipboard operation
firenvim copied to clipboard

Guifont resizes frame when it shouldn't

Open glacambre opened this issue 4 years ago • 6 comments

The initial expansion of the window is happening by itself. Then, I am resizing the browser window by dragging its edge with my cursor and it automatically fixes the the iframe size. On second thought, this might be related to another issue #972 I used the fix suggested there by adding :set guifont=Fira_Code:h20 to my init.vim and this is what caused my iframes to become oversized.

This is what I mean:

With :set guifont=Fira_Code:h20 With set guifont

Without :set guifont=Fira_Code:h20 Without set guifont

Seems like I'm trading off between a readable font size and a manageable iframe size.

Originally posted by @devanshuDesai in https://github.com/glacambre/firenvim/issues/955#issuecomment-813212957

glacambre avatar Apr 05 '21 06:04 glacambre

I think I was able to narrow it down a bit more. The issue occurs only when I have :set guifont=Fira_Code:h20 in my init.vim but not when I run it as a command as you did in your screencap.

https://user-images.githubusercontent.com/37163544/113546437-d4a7ba00-95a0-11eb-9d92-5d3ac841a8b9.mov

devanshuDesai avatar Apr 05 '21 06:04 devanshuDesai

Here's my firenvim config

let g:firenvim_config = { 
    \ 'globalSettings': {
        \ 'alt': 'all',
    \  },
    \ 'localSettings': {
        \ '.*': {
            \ 'cmdline': 'neovim',
            \ 'content': 'text',
            \ 'priority': 0,
            \ 'selector': 'textarea',
            \ 'takeover': 'never',
        \ },
    \ }
\ }"

au BufEnter github.com_*.txt set filetype=markdown
au BufEnter *ipynb*.txt set filetype=python
if exists('g:started_by_firenvim')
    " au TextChanged * ++nested write
    " au TextChangedI * ++nested write
    :set guifont=Fira_Code:h20
    let g:airline#extensions#tabline#enabled=0
endif

devanshuDesai avatar Apr 05 '21 07:04 devanshuDesai

Ah, I can reproduce that now! Thank you for investigating this a bit more, I'll try to solve this within the week :)

glacambre avatar Apr 05 '21 07:04 glacambre

I think the solution is the same as https://github.com/glacambre/firenvim/issues/800#issuecomment-757501541 . Still on the fence about merging that.

glacambre avatar Apr 25 '21 08:04 glacambre

I am using the following workaround for this currently and it works OK

function! SetFontSizeFirenvim(timer)
    set guifont=UbuntuMono:h10
endfunction

if exists('g:started_by_firenvim')
    call timer_start(3000, function("SetFontSizeFirenvim"))
endif

Sometimes there are issues when reloading the same window and you might need to experiment with the timeout length.

joelostblom avatar May 14 '22 18:05 joelostblom

if exists('g:started_by_firenvim')
    function! AdjustMinimumLines()
            if &lines < 12
                set lines=12
            endif
    endfunction
    autocmd UIEnter * call AdjustMinimumLines()
endif

This seems to work fine now without the delay

danielb2 avatar Apr 09 '23 13:04 danielb2