Skip to content
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

Undo/Redo stack is not cleared when re-focusing the same InputText #3008

Closed
elvissteinjr opened this issue Jan 31, 2020 · 1 comment
Closed

Comments

@elvissteinjr
Copy link

Version/Branch of Dear ImGui:

Version: 1.74
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_win32.cpp + imgui_impl_dx11.cpp
Compiler: MSVC19
Operating System: Windows 10

My Issue/Question:

If you type into an InputText (any variant), cancel by pressing ESC and then re-focus the input field (e.g. by clicking into it) again before any other InputText, the undo/redo stacks are preserved.

Apart from making wrong modifications, doing undos or redos in this state seems to be able to overwrite nearby memory or in the case of redo, trigger the assert at the top of STB_TEXTEDIT_INSERTCHARS().

Standalone, minimal, complete and verifiable example:

This issue can be observed in the demo code.

rokups added a commit to rokups/imgui that referenced this issue Feb 3, 2020
rokups added a commit to rokups/imgui that referenced this issue Feb 3, 2020
rokups added a commit to rokups/imgui that referenced this issue Feb 3, 2020
…estore original value. This makes restoration undoable using hotkeys.

Fixes ocornut#3008.
rokups added a commit to rokups/imgui that referenced this issue Feb 3, 2020
…estore original value. This makes restoration undoable using hotkeys.

Fixes ocornut#3008.
rokups added a commit to rokups/imgui that referenced this issue Feb 3, 2020
…estore original value. This makes restoration undoable using hotkeys.

Fixes ocornut#3008.
rokups added a commit to rokups/imgui that referenced this issue Feb 3, 2020
…estore original value. This makes restoration undoable using hotkeys.

Fixes ocornut#3008.
rokups added a commit to rokups/imgui that referenced this issue Feb 3, 2020
…estore original value. This makes restoration undoable using hotkeys.

Fixes ocornut#3008.
rokups added a commit to rokups/imgui that referenced this issue Feb 3, 2020
…estore original value. This makes restoration undoable using hotkeys.

Fixes ocornut#3008.
rokups added a commit to rokups/imgui that referenced this issue Feb 3, 2020
…estore original value. This makes restoration undoable using hotkeys.

STB change also fixes paste operation creating two entries in undo stack.

Fixes ocornut#3008.
rokups added a commit to rokups/imgui that referenced this issue Feb 3, 2020
…estore original value. This makes restoration undoable using hotkeys.

STB change also fixes paste operation creating two entries in undo stack.

Fixes ocornut#3008.
rokups added a commit to rokups/imgui that referenced this issue Feb 3, 2020
…estore original value. This makes restoration undoable using hotkeys.

STB change also fixes paste operation creating two entries in undo stack.

Fixes ocornut#3008.
rokups added a commit to rokups/imgui that referenced this issue Feb 3, 2020
…estore original value. This makes restoration undoable using hotkeys.

STB change also fixes paste operation creating two entries in undo stack.

Fixes ocornut#3008.
rokups added a commit to rokups/imgui that referenced this issue Feb 3, 2020
…estore original value. This makes restoration undoable using hotkeys.

Fixes ocornut#3008.
rokups added a commit to rokups/imgui that referenced this issue Feb 3, 2020
…estore original value. This makes restoration undoable using hotkeys.

Fixes ocornut#3008.
rokups added a commit to rokups/imgui that referenced this issue Feb 3, 2020
…estore original value. This makes restoration undoable using hotkeys.

Fixes ocornut#3008.
@ocornut ocornut closed this as completed in 83efdce Feb 3, 2020
@ocornut
Copy link
Owner

ocornut commented Feb 3, 2020

Hello @elvissteinjr ,
Thanks for the report. This should be fixed now.
We made the ESC revert operation undoable itself which seemed to be the least destructive design. So if you press ESC and then focus again and press Ctrl-Z this will essentially undo the revert.

ocornut added a commit that referenced this issue May 25, 2022
…revert after a deletion would lead to small garbage being displayed for one frame. (#3008)

Curiously very old, amend 83efdce and bdbb2b2. Using stb_ functions updated ->CurLenA without updating ->TextA, leading to `buf_display_end = buf_display + state->CurLenA;` in the display.
Since f3ab5e6 they are 1 case out of 4 which didn't apply back to ->TextA and this is essentially the one where we ensure appliance. Another solution would be to alter the lower display code, but applying to TextA makes things more consistent.
ocornut added a commit that referenced this issue Sep 20, 2022
… Escape + disable cursor rendering on revert frame. (#3008)

Amend bdbb2b2, 83efdce
BramblePie pushed a commit to BramblePie/imgui that referenced this issue Oct 26, 2022
… Escape + disable cursor rendering on revert frame. (ocornut#3008)

Amend bdbb2b2, 83efdce
kjblanchard pushed a commit to kjblanchard/imgui that referenced this issue May 5, 2023
… Escape + disable cursor rendering on revert frame. (ocornut#3008)

Amend bdbb2b2, 83efdce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants