-
Notifications
You must be signed in to change notification settings - Fork 170
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GuiCursor Support #623
Conversation
@equalsraf I am curious if you have any opinions on how I had planned on adding an options-check in if (true) // :GuiCursor? Setting to enable/disable?
{
ShellWidget::paintEvent(ev);
return;
} We could do a few things:
I was thinking we could add an on-by-default setting |
Why is |
@justinmk Good point. I suppose I didn't fully understand It is nice to have a fallback for disabling new features, in case something is broken. It looks like |
The option I still need to check how well this behaves with older versions of |
Enable by default since the existing implementation is a bit of an hack in any case. I dont think we need any specific commands for this. We can fallback to current behaviour if something weird happens (like a missing option). I dont see any harm in adding an escape hatch just for disabling this. |
Interesting... It looks like nvim-qt does not currently work with The lowest working version is
This sounds good to me. Let's get Once this is merged, I will create an Issue to track removal of the old cursor code. |
The current iteration works down to The fallback paths from |
I'm ok with this 馃憤 |
Let's make A user that gets this Supporting the old highlight API requires more complicated async code, and won't benefit many users. Attached is a (rough) patch to support |
a6ce76b
to
05dbe33
Compare
Done. This should be ready for merge. I have tested the basic features (blink, styling, shape/size), and everything looks good for new and old versions of A quick test and proof read of the code on someone else's machine wouldn't hurt... There is a decent amount of new and refactored code in this change :) Thanks! |
Use C++11 in-class member initializers for primitive types.
Use C++11 in-class member initializers for primitive types.
The cursor is being moved from NeovimQt::Shell into ShellWidget. This will allow the guicursor rendering to be handled directly in ShellWidget::paintEvent(...).
HighlightAttribute should be marked as noexcept because no functions throw.
The Neovim MsgPack API sends highlight information using the same format in several different places. Add a convenience constructor to reduce code duplication. Used by ext_linegrid and guicursor.
Extends ShellWidget to support a basic cursor abstraction. When the Shell object receives style updates, it can forward this styling information. ShellWidget will then handle the rendering of the cursor (color, blink state, position, etc). The guicursor option is on-by-default, and can be disabled via: `:set guicursor=` This will cause neovim-qt to fall back to the old XOR based cursor.
05dbe33
to
670f3bd
Compare
The merge with #643 has been handled. I did some quick re-testing, and everything still looks good. |
Based on #520
Thanks @b-r-o-c-k, your Pull Request was instrumental in putting this together and understanding the various guicursor options. 馃槃
I have moved some of the cursor code from
Shell
intoShellWidget
, so we can have a clean abstraction. Moving the cursor there allows us to keepCell
immutable, and avoidconst_cast
. I have also integrated guicursor styling with the newHighlightAttribute
map from work on ext_linegrid.I think this still needs a minimum neovim API version, I am not yet sure which one we should use due to the highlight map and
hl_id
vsattr_id
. I will investigate...