cosmic-text icon indicating copy to clipboard operation
cosmic-text copied to clipboard

Hide cursor based on selection, preedit, or config

Open Riateche opened this issue 1 year ago • 1 comments

  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 avatar Jun 08 '24 12:06 Riateche

Rebased onto main. Please take a look.

Riateche avatar Aug 25 '24 13:08 Riateche