-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Externalize handling of window layout and control (wincmds) to UIs #8707
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
Conversation
@utkarshme what is the status of this branch? Does all three modes (TUI/single-grid, ext_multigrid-but-not-ext_windows, ext_windows) work somewhat properly with this code? Does it contain all work relevant for the final GSOC submission ? |
This branch was kind of neglected because of getting #8455 to work. 😅 The All in all, it contains all work done for GSoC so far and will be the branch that we will be submitting. ✌️ |
1570ae2
to
0fa6c75
Compare
src/nvim/api/ui.c
Outdated
return 0; | ||
} | ||
|
||
if (!object_to_vim(result, &rettv, &error)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This convert is not needed, we can just check result.type == kObjectTypeInteger
.
src/nvim/api/ui.c
Outdated
&error); | ||
|
||
if (ERROR_SET(&error)) { | ||
api_set_error(&error, kErrorTypeException, "%s", error.msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this just self-assigns the error object, we want something like EMSG2(_("Error invoking win_move_cursor: %s"), error.msg);
At the end of the GSoC coding period, the state of this PR was this. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@megalithic It will certainly be merged, but its hard to give a timetable. If this PR looks stale, it is because the focus is currently on #8455 which @utkarshme and I are working on to get it done for merging and which is the foundation this PR builds upon.
The more the TUI is just another GUI the better. There is no concrete plans for replacing the current TUI, but it would certainly be interesting project for someone to implement a new TUI based on the full external UI protocol. |
@bfredl Sounds good! I will check out latest |
@Breja You can experiment with this too now! 😄 |
Looks like some tests need to be adjusted/updated. |
I try to play around with this and got a bit confused about how the workflow should be between nvim and the UI. I'm pretty sure I miss something 😕 When I start up nvim, the first window created automatically has still the size of the main grid, like without I started with implementing
What I'm trying is to implement a layout with a global scrollbar and windows sized by their content: https://github.com/hoschi/yode have a look at the video or play with the demo :)
But I don't know where I should put this logic. Would this be
But where is the positioning logic implemented? Is this done by the UI holding a representation of the current layout of the splits and never telling nvim something about it? The Oooor did I get the intention of this PR completely wrong and it was never the idea to implement a layout where the splits can outgrow the main grid and a global scrollbar is needed? I hope that probably @coditva can shed some light on my questions :) |
This function only sets the "inner" grid size, i e the number of text rows and colums that can be rendered inside the window. We would need a separate function for if nvim/plugins need to know the position and "outer" position (which depends on the font size of the window, and scrollbars and borders and such). Perhaps the ideas of #11943 could be extended also to windows when in |
Do I get it right that it was not intended to let the UI control the position, size and layout of splits by this PR? |
@hoschi The UI can control the size and position of splits, there is just no way (yet in this PR) for an UI to report the info back to neovim (for plugins who want to inspect the layout etc). |
@bfredl that "The UI can control the size and position of splits" is what I want to do 👍 I want to build a UI which controls the windows position/size which is not tied to the traditional frame structure fitting in a main grid size. 🙂 Do I need to report the position/size info back to neovim (which is not possible with this PR, yet) to achieve this goal? If no, meaning it should work with this PR, what did I do wrong in the workflow described above? |
@hoschi Just wondering, have you considered using floating windows exclusively, one floating window per grid? Then you'd be free to position your windows as you wish. |
@glacambre thanks for the pointer! the last time I looked into the API for floating windows they were not suitable for my approach, because they had drawbacks (no number column, gutter for git info, ...) to be an alternative of normal windows. I had a very quick look again today and was also thinking if it would may sense to use only floating windows, but hadn't enough time to dive into this. Afaik, a floating window needs an anchor from a normal window, but this is not the case anymore? Because the windows I want to draw are not related to another window.
api: the second half of the sentence made my curious if this limitation would make problems for my use case. I'll have a closer look tomorrow. Probably one main window plus all other windows are floats could be a way to implement the layout I want. |
@hoschi I think
Floats can actually have these, just don't set the "minimal" flag in |
@bfredl I would also prefere |
@coditva @bfredl I've rebased this branch to latest master, here: https://github.com/yatli/neovim/tree/ext-win |
This comment was marked as off-topic.
This comment was marked as off-topic.
Continued in #13504 |
Nvim manages all the window layout by keeping a frame structure for it. UIs might want to take greater control over the layout and navigation which could not be provided in the current scenario.
This work delegates handling of these actions to external UIs (if they choose to by setting
ext_windows
) and gets rid of the frames internally. UIs have control over how to interpretwincmd
s which can be pretty useful to UI rich text editors like Oni.This work build on top of previous work by @bfredl in #8221 and me in #8455. Ref #8320.