Immediate-Mode-UI / Immediate-Mode-UI/Nuklear
Restore cursor position in nk_edit_string ?
- Dominant language
- C
- Stars
- 11.4k
- Forks
- 686
- Avg merge
- 4d 1h
- Merged PRs (30d)
- 3
Description
Hi folks,
First time posting here, so first things first: thanks for this great project. I have been using it for a while and <3 it. But I ran into a small problem:
I am using a text edit filed (nk_edit_string) and am programmatically re-focusing it (nk_edit_focus). Works well, however the position of the cursor gets reset.
It would be great to have a flag for the nk_edit_string to make it remember its cursor position (I think there is none as of now). Sadly, my familiarity with nuklear's internals is very limited. I solved this by adding functions to get and set the cursor position (https://github.com/alexandervanrenen/Nuklear/commit/c74da8ad5847f90824d310ef87fb82aa55cf45ef).
My question would be if this feature is of general interest: Is there a good way to already accomplish this? Would it be possible to add such a flag or use functions to set the cursor position?
Thanks,
Alex
Contributor guide
Research direction
Start by reading the nk_edit_string and nk_edit_focus entry points and tracing how focus changes the cursor position. Determine how cursor state is currently stored and choose whether the requested behavior needs a flag or public getter/setter functions. Done means programmatic refocusing can preserve or explicitly restore the cursor position without breaking existing text editing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- desktop
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100