mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-14 19:04:44 +00:00
Undo, Redo Bug at Multi-line Text Input #715
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#715
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I found a bug at Undo, Redo at Multi-line Text Input
After I copy (Ctrl-c) all of texts
move down new bottom line and paste (Ctrl-v) 3 time
and undo (ctrl-z) 3time and redo (ctrl-y) 1time
then it always crushed.
It is a writing access violation exception
it can be reproduced again and again.
and stopped at this line (memmove)
You can fix the formatting by surrounding your code with 3 backticks `. You can also set the language for highlighting.
thanks I changed the formating
I cannot seem to repro. Are you running Master?
There was a bug fix around similar code in https://github.com/ocornut/imgui/issues/681
Yes I clone it from master.
I will make a video for easily making it again
First copy all of texts in Multi-line Text Input window
and paste 3 time and undo 3time and redo 1time then application will be crushed.
ctrl-c (whole area) > ctrl-v ( at last line) > ctrl-v > ctrl -v > ctrl-z > ctrl-z > ctrl-z > ctrl-y
(I know about #681 but it is not that version, I think that it remains some problems)
OK i got it. Sorry I was doing CTRL+V again instead of CTRL+Y.
nope, it is good to be checked a bug.
oh. it is not good... it is a bug.. I do not know what I do say. in this case.
just I am looking forward to your great job, and I want it would be a help for imgui
It's closely related to the same function as #681 which is a rarely exercised path. By default we have 999 characters worth for the various undo-buffers and when this overflow that code path tries to remove older entries.
After 3 pastes and 2 undoes

After 3 pastes and 3 undoes

At this point I think the undo stack state is incorrect.. but I'm still confused by this code. Will investigate.
By the way, I should definitively increase that number from 999 to maybe 10K, that's still a low footprint. But only when we have fixed the bug :)
We know a deep debugging is hard for everyone.
I do not know I gave you just a burden only.
I will find something to help you too.
I am quite confused by the undo-stack system in stb_textedit.h, will probably end up asking Sean Barrett but I don't want to bother him before I obtain more information. I suspect there are a few other bugs in there.
Just doing Copy, Paste, Undo, Redo, Undo, Redo, Undo, Redo... Seems to exhaust the char buffer which I don't think should happen. I think the fix for that is to add this in
stb_text_redo:But that doesn't fix the bug you are mentioning above. All of this intimately connected so I need to understand the logic behind
stb_textedit_discard_undostb_textedit_discard_redobefore. Right now struggling to make sense of it.Other fix in
stb_textedit_discard_redoReplace
By
Test code:
A. Add
#define STB_TEXTEDIT_UNDOSTATECOUNT 10in imgui_internal.hB. Display state:
I am not 100% sure and need to do more testing. It may be completely wrong.
I am applying the fix now. Looking ok but awaiting further user testing. Let me know if you stumble on anything wrong.