Skip to content
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

Cant disable cursor styling #1063

Open
manungsa opened this issue Apr 5, 2023 · 4 comments
Open

Cant disable cursor styling #1063

manungsa opened this issue Apr 5, 2023 · 4 comments

Comments

@manungsa
Copy link

manungsa commented Apr 5, 2023

Platform:
Endeavour OS Linux (Arch based)

I have a line on my configuration file to disable cursor styling:

vim.o.guicursor = nil
-- or
vim.o.guicursor = ""
-- either way works on regular Neovim on terminal

But it doesn't get sourced when I open nvim-qt. The other configuration option works, so I think it may be a problem on nvim-qt's guicursor implementation. Anyone having the same problem?

@jgehrig
Copy link
Collaborator

jgehrig commented Apr 28, 2023

We should support the guicursor option, however I'm not familiar with setting it via vim.o.guicursor.

I'm only familiar with configuring the cursor via set guicursor=... in init.vim or vimrc.

Can you provide some additional details so I can reproduce (and hopefully fix) the issue?

What do you expect to happen, and what happens instead?


You could also try setting the option to a style-less default, such as:
guicursor=n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20

@manungsa
Copy link
Author

These configuration line is basically the same as

set guicursor=

So I expect the cursor to go full block style, but after restarting nvim-qt the cursor still change according to the mode where I'm in, e.g. in Insert mode the cursor changed to thin style, on Replace mode the cursor go underscore style.

@jgehrig
Copy link
Collaborator

jgehrig commented May 1, 2023

Okay, I see what is going on here. We do support cursor styling and the lack thereof.

However, when no cursor styling is applied, we use some defaults:

neovim-qt/src/gui/shell.cpp

Lines 695 to 714 in b4ca557

if (!m_cursor.IsStyleEnabled()) {
if (mode == "insert") {
m_cursor.SetColor({});
m_cursor.SetStyle(Cursor::Shape::Vertical, 25);
m_cursor.SetTimer(0, 0, 0);
}
else if (mode == "replace") {
m_cursor.SetColor({});
m_cursor.SetStyle(Cursor::Shape::Horizontal, 20);
m_cursor.SetTimer(0, 0, 0);
}
else {
m_cursor.SetColor({});
m_cursor.SetStyle(Cursor::Shape::Block, 100);
m_cursor.SetTimer(0, 0, 0);
}
update(neovimCursorRect());
return;
}

To get the behavior you're looking for, we would need to set the cursor into block mode whenever styling is disabled.

I don't think what we're doing is strictly wrong, but there is a behavior difference from the TUI.

Generally, we try to match the TUI behavior when possible.


In the meantime, you could explicitly specify how you want the cursor to behave:

guicursor=n-v-c-sm-i-ci-ve-r-cr-o:block

@manungsa
Copy link
Author

manungsa commented May 3, 2023

The guicursor=n-v-c-sm-i-ci-ve-r-cr-o:block worked tbh. I will use it for now. Thanks!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants