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

Hide cursor based on selection, preedit, or config #263

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Riateche
Copy link
Contributor

@Riateche Riateche commented Jun 8, 2024

  1. Cursor is now hidden when there is a selection.
  2. Cursor is now hidden when there is an IME preedit that specifies that there should be no cursor.
  3. Added Edit::set_cursor_hidden() to hide cursor manually, which can be used to implement cursor blinking, and to hide cursor when the input is unfocused or read only.

While I generally prefer "positive" boolean flags (e.g. set_cursor_visible() would generally be better), in this case the logic looks simpler when we use the hidden flag: cursor_hidden = has_selection || has_preedit_without_cursor || set_cursor_hidden.

@Riateche
Copy link
Contributor Author

Rebased onto main. Please take a look.

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

Successfully merging this pull request may close these issues.

1 participant