daa84 / neovim-gtk

gtk ui for neovim
GNU General Public License v3.0
718 stars 56 forks source link

Not resizing properly in i3 #58

Closed matiuri closed 6 years ago

matiuri commented 6 years ago

When launching neovim-gtk from terminal in tiling mode, it will consider the size of the previous instance, instead of the size of this instance's window. As a result of this, the airline-tabline on the top won't be shown unless I exit neovim-gtk and relaunch it to be on the exact same size as before. Furthermore, if I last opened it in a small tile, when I open it again in full screen mode, it will be shown as in the picture. captura de pantalla de 2018-02-13 20-40-54

I don't know if this error is related: ERROR:<unknown>: Error while reading: I/O error while reading marker byte: failed to fill whole buffer. It's shown every time I close with :q.

daa84 commented 6 years ago

Default window size stored when window close and then sets with gtk_window_set_default_size. But later change must generate configure-event that will change content size. Looks like for some reason resize event does not generate configure-event, but set_default_size generates.

Can't say how to debug this on default ubuntu

daa84 commented 6 years ago

Maybe just add some key to disable size saving

matiuri commented 6 years ago

I don't get it. Should I disable size saving? If so, how?

daa84 commented 6 years ago

I think i can add new option to disable size saving

Zardoz89 commented 6 years ago

I don't know if is related, but I can't resize anymore nvim-gtk window, using the window borders. The only way that It works, is if I do right click on the app title bar and select "resize option"

daa84 commented 6 years ago

added --disable-win-restore option, you can try it, if this solve this issue.

matiuri commented 6 years ago

When I open neovim-gtk with that parameter inside an empty working space, it'll mostly be show as in the first picture, and rarely as in the second one. captura de pantalla de 2018-02-16 07-36-06 captura de pantalla de 2018-02-16 07-35-33

Note on the first picture: it seems that neovim might be rendering a bit out of frame, as my top bar is not showing and the bottom black space is too big.

unclechu commented 6 years ago

I have kinda like this issue with i3 too. Sometimes it just gets wrong height, and last command line is shifted behind visible part of the window. When it happens I'm usually toggle fullscreen mode to fix it. And this issue appeared after some commits about "window resize" (sad but I don't remember exact one, I guess it was few months ago). In the past I haven't this issue.

matiuri commented 6 years ago

@unclechu Do you have the same problem with Airline's buffer line, too?

daa84 commented 6 years ago

Can't say how to debug this. I add ability to log messages for resize events in latest commit. Please run it like RUST_LOG=nvim_gtk::shell cargo run Also some questions:

Please past logs from above command here. First reproduce error, then past logs. Maybe latest/ not stable neovim does not have such error?

matiuri commented 6 years ago

Neovim version: 0.2.2

If neovim-gtk's tabline is enabled:

captura de pantalla de 2018-02-17 07-45-22 The only case on which I can see Airline's buffers bar

DEBUG 2018-02-17T10:44:59Z: nvim_gtk::shell: Init nvim 100/40
DEBUG 2018-02-17T10:44:59Z: nvim_gtk::shell: configure_event (800, 600)
DEBUG 2018-02-17T10:44:59Z: nvim_gtk::shell: configure_event (1916, 1046)
DEBUG 2018-02-17T10:44:59Z: nvim_gtk::shell: on_resize 100/40

captura de pantalla de 2018-02-17 07-53-46

DEBUG 2018-02-17T10:44:52Z: nvim_gtk::shell: Init nvim 100/40
DEBUG 2018-02-17T10:44:52Z: nvim_gtk::shell: configure_event (800, 600)
DEBUG 2018-02-17T10:44:52Z: nvim_gtk::shell: configure_event (1916, 1046)
DEBUG 2018-02-17T10:44:53Z: nvim_gtk::shell: ui_try_resize 239/69
DEBUG 2018-02-17T10:44:53Z: nvim_gtk::shell: on_resize 100/40
DEBUG 2018-02-17T10:44:53Z: nvim_gtk::shell: on_resize 239/69

If neovim-gtk's tabline is disabled:

captura de pantalla de 2018-02-17 07-52-08 The line's number is moved to the text section

DEBUG 2018-02-17T10:51:16Z: nvim_gtk::shell: Init nvim 100/40
DEBUG 2018-02-17T10:51:16Z: nvim_gtk::shell: configure_event (800, 600)
DEBUG 2018-02-17T10:51:17Z: nvim_gtk::shell: configure_event (1916, 1046)
DEBUG 2018-02-17T10:51:17Z: nvim_gtk::shell: ui_try_resize 239/69
DEBUG 2018-02-17T10:51:17Z: nvim_gtk::shell: on_resize 100/40
DEBUG 2018-02-17T10:51:17Z: nvim_gtk::shell: on_resize 239/69
DEBUG 2018-02-17T10:51:17Z: nvim_gtk::shell: on_resize 239/69
unclechu commented 6 years ago

@matiuri

Do you have the same problem with Airline's buffer line, too?

No I don't, but it may be just because I usually don't have vertically split windows along with neovim-gtk window, so I haven't faced issue with window width (only with height).

unclechu commented 6 years ago

I found a way to reproduce it properly. I can reproduce it on latest commit: 8bf342ec7f6b0bc0f0877d62a491d4322f9ce266

  1. Open nvim-gtk
  2. Open vim-ctrlspace window and close it
  3. One bottom line is shifted
  4. Toggle fullscreen mode twice (X11 fullscreen, i3 key hook)
  5. After this the issue won't appear anymore

Also if I toggle fullscreen just after nvim-gtk started this issue also won't appear. Screencast: https://youtu.be/Kn0G479SAuE

I just realized also that top airline line is also behind the screen after start.

matiuri commented 6 years ago

Now the line's number will always be in the text section until I resize the window or create a new line. captura de pantalla de 2018-02-18 12-18-51

daa84 commented 6 years ago

Does commit 8bf342e change something? Strange behavior can be some neovim problem, that does not correctly process a lot of size change events. Previously there was some timeout after that size change is applied, i remove it some time ago. Maybe move it back is a good idea.

daa84 commented 6 years ago

please try it with latest commit

matiuri commented 6 years ago

Same problem with 7e857a1. And yes, the last screenshot was on 8bf342e.

matiuri commented 6 years ago

When neovim-gtk starts, everything is OK. Then, on first resize to fill the window, Airline's buffer bar disappear. Finally, on second resize to assure it fills the whole window, the line's number is tabbed. After that, toggling fullscreen on and off will solve everything but Airline's buffer bar, which won't show again.

unclechu commented 6 years ago

I have this fixed with f9b20db.

daa84 commented 6 years ago

Looks like there two bugs,

  1. resize does not happens at all,
  2. some problems with layout after resize

so looks like 1 is fixed and 2. not? second question can it be that 2. is not problem of neovim-gtk, but more neovim + some plugin configuration?

unclechu commented 6 years ago

Now with f9b20db I have this: Look, when I execute this function: https://github.com/unclechu/neovimrc/blob/fe6326a/my-modules/background-toggle.vim#L4-L10 I have this (see short screencast): https://youtu.be/qWcNBoq4R0Y I have broken size of screen and left-top part of airline at the bottom of the screen, only fullscreen toggle heals it. But when I recorded screencast, second time, I couldn't reproduce issue with wrong size, in previous try I had right-top part of airline behind the screen (expanded about 1 column) and bottom line behind the screen too. In TUI it's okay.

daa84 commented 6 years ago

Hmm, ok, time to time I also can reproduce this, without timeout - this was much more times, but with timeout this also happens sometimes.