Skip to content

Instantly share code, notes, and snippets.

@cketti
Created July 23, 2020 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cketti/65a75614082222a7c9bf0fa05c8781d2 to your computer and use it in GitHub Desktop.
Save cketti/65a75614082222a7c9bf0fa05c8781d2 to your computer and use it in GitHub Desktop.
private void invalidateCursorPositionHack() {
int oldStart = getSelectionStart();
int oldEnd = getSelectionEnd();
// The selection values need to actually change in order for the cursor to be redrawn. If the cursor already
// is at position 0 this won't trigger a redraw. But that's fine because the size of our span can't influence
// cursor position 0.
setSelection(0);
setSelection(oldStart, oldEnd);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment