Skip to content

Conversation

@ocornut
Copy link
Contributor

@ocornut ocornut commented Sep 11, 2025

Seems like a small bug that has been there from initial release.
(unless this was trying to mimick some text editor but the behavior is rather odd so this seems unlikely to me)
All text editors I have tried behave like after the fix.

Repro:

  • Perform a selection over multiple lines (which does not end up at end of the last selected line, otherwise issue is not noticeable)
  • Press STB_TEXTEDIT_K_LINEEND key.
  • Notice that cursor is moved to the end of the line corresponding to the beginning of selection.
  • Desired: moved to the end of the line corresponding to the end of selection.

The code for Shift+STB_TEXTEDIT_K_LINEEND however works correctly and move the cursor at the right location, meaning there's a cursor moving difference between End and Shift+End, which arguably seems like a bug.

Calling stb_textedit_move_to_last() instead of stb_textedit_move_to_first() matches what STB_TEXTEDIT_K_RIGHT, STB_TEXTEDIT_K_WORDRIGHT paths are using.

The reason IMHO it hasn't been noticed is that when doing a multi-line selection you rarely want to press End without Shift.

Thank you!

@nothings
Copy link
Owner

makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants