Skip to content

Cursor color #1

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

Open
doronbehar opened this issue Oct 18, 2019 · 3 comments
Open

Cursor color #1

doronbehar opened this issue Oct 18, 2019 · 3 comments
Labels
cantfix Requires upstream changes enhancement New feature or request

Comments

@doronbehar
Copy link

Hi!

I just came around your plugin via your reddit post (I think it's yours) and I have a question:

Say I have the color #FFFFFF. When the cursor hovers on this text, I can't see it. Would it be possible to make nvim-colorizer.lua change the highlighting groups nCursor and / or Cursor so the cursor will be visible in such edge cases?

@norcalli
Copy link
Owner

Thanks for the issue! I'll look into it to see how it affects the performance since it would have to update on CursorMoved based on what you're suggesting, which could potentially be slow. Considering that, I could probably put it under an optional configuration setting which you could set under the defaults if you really like it.

@norcalli norcalli added the enhancement New feature or request label Oct 18, 2019
@norcalli
Copy link
Owner

I figured out a way to do this, so I'm going to write it here for my future reference when I get around to it (since I'm busy today).

The mechanism for doing this with neovim doesn't exist right now to get the highlight under the cursor, so I'll have to maintain a memory of the highlight regions.

I can maintain a single global table containing the highlight regions in order and do a binary search of list to find the cursors position (or a linear search, the performance will probably be negligible in difference), then I can ascertain the highlight under the cursor if a match is found.

With an autocmd on CursorMove, I'll only need to calculate this array if the line number changes or the text changes, and not the column number, so it'll involve recalculating the current row, but with how quick that is, I don't think the performance will be a problem.

If the buffer changes, this will also need to be invalidated/updated, which may or may not be covered by CursorMove.

@norcalli
Copy link
Owner

Implemented in #16, but unfortunately, I don't have a good way of testing this. Cursor color isn't a standardized terminal feature, and GUIs can implement it however they want. I recommend trying that branch if your terminal supports it and let me know if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cantfix Requires upstream changes enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants