-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
ImGuiInputTextFlags_AlwaysInsertMode forces overwrite mode instead of insert mode #2863
Comments
Thank you @jstine35 for pointing this out. It should be called So the idea is that we should fix the name rather than changing the behavior. It is expected that the default behavior of an Action:
I think the reason I didn't add support for Insert key actually toggling this is because I wasn't happy with the current behavior of stb_textedit.h when in overwrite mode and reaching the end of a line. The line that does this check: I will try to look into it eventually, would would happily accept a patch. I think the patch should probably be also pushed to the nothings/stb repo, including renaming the |
Thanks for the clarification with MemoryView. Indeed, I had bugged up our MemoryView by changing ImGui internal behavior. I've gone and removed the errant uses of I had thought that stb_textedit logic seemed suspicious too, though I think I was still being misled by the
So. I believe that should be the expected behavior? |
FYI I pushed renaming this flag from As for actual handling of Insert key in text field I'll work on this separately (also added to todo list).
I'm not sure I understood what you meant there. Failure due to full buffer shouldn't happen when overwriting? |
This branch 30f2ca8 adds support for INSERT key to toggle overwrite mode. My problem right now is I am not 100% sure if:
In the context of a text editor it seems like an always available thing to have this toggle on the Insert key. Also, making it opt-in would facilitate people creating application where things feels inconsistent to end user. |
When applying
ImGuiInputTextFlags_AlwaysInsertMode
to an InputText, the observed behavior is overwrite rather insert.I believe the usefulness of the flag currently is minimal, since there's no built-in support for toggling insert/overwrite modes. This would explain it going unreported, since the workaround is literally "don't use that flag." Even so, it would be helpful if the flag's behavior were corrected so that it, at a minimum, doesn't enforce overwrite behavior.
Relevant code snippet in imgui_widgets.cpp:
... the culprit being that STB's
insert_mode
flag is 0 for insert, and 1 for overwrite. Changing the above line to0
resolves the most confusing aspect of this issue.The text was updated successfully, but these errors were encountered: