git-messenger.vim icon indicating copy to clipboard operation
git-messenger.vim copied to clipboard

Float window is not respectively sized its the content

Open megalithic opened this issue 6 years ago • 5 comments

Love this plugin, however, at some point, the floating window just got huge/oversized and won't size to the content itself. I've tried setting the g:git_messenger_max_popup_height and g:git_messenger_max_popup_width plugin preferences, but they don't seem to make a difference. CoC and other popup/floating window plugins seem to be fine. Any thoughts of what I might look at/adjust to try and fix?

git-messenger-float-window-oversized

megalithic avatar Sep 09 '19 16:09 megalithic

Float window size should be shrunk to fit to its contents as screenshot in README file. Window size is calculated here:

https://github.com/rhysd/git-messenger.vim/blob/master/autoload/gitmessenger/popup.vim#L59

However, as you showed in screenshot, the calculation seems not correct in some case. Would you tell me more information to reproduce this. Then I would be able to analyze what is happening.

rhysd avatar Sep 10 '19 11:09 rhysd

@rhysd thank you, i went and added some echo's for the height and width reported by that function you referenced above. i'm getting a computed width of 50 and a height of 8. That DEFINITELY doesn't look right. I don't know how to tell you to recreate. Other than pulling down my config found here: https://github.com/megalithic/dotfiles/blob/master/nvim/init.vim

megalithic avatar Sep 10 '19 18:09 megalithic

Thank you for confirming that. I'm trying your repository. However, on my local environment, the window size is correct:

スクリーンショット 2019-09-11 9 54 51

There would be some hidden condition. Would you check the opts variable here?

https://github.com/rhysd/git-messenger.vim/blob/72975c9be9267689cd408a5ea6a02200502217d0/autoload/gitmessenger/popup.vim#L142

It is an option dictionary passed to nvim_open_win(). I want to confirm options are correct or not. If the value is correct, perhaps it may be a bug of Neovim or some effects from other plugins. Rebuilding the latest nightly Neovim may solve this issue in the case.

rhysd avatar Sep 11 '19 01:09 rhysd

@rhysd thanks again for helping with this.. please find the attached screenshot (see the echo'd sizings from the line number you mentioned for the opts dict)

Screenshot 2019-09-12 09 09 00

megalithic avatar Sep 12 '19 14:09 megalithic

Thank you for trying that.

Let me confirm one thing. The output in your screenshot is

OPTS: width54, height: 11, row: 1, col: 0

Does it mean that the opts dict was { width: 54, height: 11, row: 1, col: 0}? If you're ok, adding following line and dumping entire dictionary would be more helpful:

echom string(opts)

Anyway, it seems that a dictionary passed to nvim_open_win() has correct size information. I'm still not understanding why your float window does not follow the size. Possible reasons would be

  1. Some autocmd hook changes size of window (some other plugin may hook WinEnter or BufEnter or some events)
  2. Neovim's bug

Would you also tell me your OS and Neovim's version (especially the git revision of your Neovim build)? Then I would be able to align environment with you. If possible, temporarily removing other plugins and load only git-messenger.vim in your environment is helpful to ensure that other plugin does not affect.

rhysd avatar Sep 14 '19 16:09 rhysd