Bugzilla – Bug 2501
Undo for label edit results in a blank label
Last modified: 2021-01-26 11:33:15 UTC
On Mac using Undo to revert a label edit results in a blank label AFAICT this is not a regression - bit I can only test as far back as 2.3.1 as I am on Catalina which does not support 32-but apps. Undoing a label edit on Windows works properly - so assume Mac-only for now.
This is still the case in 3.0.0 Audacity 3.0.0 25ddfc7
Let's say at step 1 you created a label with "abcdef" for the label. Then at step 2 you click the label, press "g", press "h", press "i", press CTRL+Z. Now, I know that the current behavior is wrong, but what do you expect to happen at step 3? Do you expect the "i" to be undone or do you expect the label to be what it was before step 2?
(In reply to Leland Lucius from comment #2) I expect the "ghi" to be removed as that group was a single editing action. If you added the "gh" then did something else to remove focus from the label and then edited the label adding the "i" and then did Ctrl+Z I expect then just the "i" to be removed. Testing on Windows this morning for comparison shows me that this issue now also occurs on Windows as well - so I'll change this to All Platforms.
(In reply to Peter Sampson from comment #3) >I expect the "ghi" to be removed as that group was a single editing action. And note that there is only one item on the History stack for this label modification
Pr(In reply to Peter Sampson from comment #3) > (In reply to Leland Lucius from comment #2) > I expect the "ghi" to be removed as that group was a single editing action. > > > If you added the "gh" then did something else to remove focus from the label > and then edited the label adding the "i" and then did Ctrl+Z I expect then > just the "i" to be removed. > > Perfect. That's what I expect too. I'll see if I can make it work that way.
Fix in: https://github.com/audacity/audacity/comamit/a03a6ab But, along the way I "fixed" a couple other things. (Do these in a version prior to this fix.) 1) Missing vertical cursor: a) CTRL+B to create label b) Enter "asdf" and press ENTER c) CTRL+Z to undo Notice that the vertical cursor is not displayed. 2) Undo undoes too much a) CTRL+B to create label b) Enter "asdf" and press ENTER c) Click the label, add "qwer" and press ENTER d) CTRL+Z to undo Notice that both edits are undone...should have only been the second one 3) Undo undoes too much...variant to #2 a) CTRL+B to create label b) Enter "asdf" and press ENTER c) Click the label, add "qwer" d) Press CTRL+Z
(In reply to Leland Lucius from comment #6) Testing on W10 with Audacity 3.0.0 0fcf9ff The bug as staed in the title and steps to reproduce works ok - but there is a residual a) CTRL+B to create label b) Enter "asdf" and press ENTER c) Click the label, add "qwer" and press ENTER d) CTRL+Z to undo e) Observe: this deletes "qwer" - leaving "asdf" in the label (this is this bug as stated - but now f) CTRL+Z to undo g) label is left as CTRL+Z to undo Contrast this with if after step b) you: i) CTRL+Z to undo ii) Observe: label remains but is empty iii) CTRL+Z to undo iv) Observe: label is deleted these are expected behaviors REOPENING this for the residual
(In reply to Leland Lucius from comment #6) Testing on macOS 11.1 Big Sur with Audacity 3.0.0 0fcf9ff Same basic good behavior but also same residual behavior as on W10 in Comment #7
(In reply to Peter Sampson from comment #7) > (In reply to Leland Lucius from comment #6) > Testing on W10 with Audacity 3.0.0 0fcf9ff > > The bug as staed in the title and steps to reproduce works ok - but there is > a residual > > > a) CTRL+B to create label > b) Enter "asdf" and press ENTER > c) Click the label, add "qwer" and press ENTER > d) CTRL+Z to undo > e) Observe: this deletes "qwer" - leaving "asdf" in the label > (this is this bug as stated - but now > f) CTRL+Z to undo > g) label is left as CTRL+Z to undo > I rather think that step "f" is the bug as stated since the original steps to reproduce didn't modify the label at step "2". And prior to doing the CTRL+Z at step "f", you basically have an unmodified label...just like you had at step "3" in the original steps to reproduce. It's really hard to explain what was going on prior to this change, but you can see it by watching History while doing the original steps to reproduce (using an older version of Audacity). At step 3, you can see the "Modified Label" action is "removed". That's because Undo was simply doing what you asked...it undid the last change. So, what I've tried to do is create a "pseudo editing mode" that is entered anytime a label becomes active. This "mode" blocks Undo from doing anything beyond what was done to the label in the current activation. However, if you want that ability, it is easy to do. But, you'll find that the bug as stated will (seemingly) return since just activating a label (step 2) doesn't make a change to it and Undo will happily undo the text you entered in step 1. I say "seemingly" because the fix also creates a new Undo entry upon the first change in each editing session. So, if you modify a label, press ENTER, and modify it again, you'll see 2 "Modified Label" items in History. Prior to this change, both edits would be consolidated into one, even though they were 2 distinct activities. Anyway, let me know if you'd like me to disable the "undo blocker". It's real easy to do.
I have explained that I do not like the change to EditMenus.cpp. It is not necessary for the other fixes for the other things described in comment 6. It is also not necessary to fix the steps as reproduced. All that was really needed was to implement the non-consolidation of undo items. If I disable that part of the fix, then: at step 4, the label is correctly as-was at step 1. Then I SHOULD be able to undo again, bringing the label back to its empty state.
Please retest at commit 35e9afe34d4dccd8dea3edea670155ac87f3e5e7 I removed the "undo blocking" complication in this fix. If you reproduce steps now, the result is that the Undo history has three states, one with a new but blank label, one with the first label text (as a label modification), and one with the modified text. Now you can undo just the last modification; undo again gives a blank label; undo again removes the label. That's so with or without the "undo blocking." Maybe one would think the first two of the three states should be combined, so there is no undo state remaining with a blank label, but there are two states. That would be a residual that would require another fix. Or one might interpret current behavior as correct.
So basically, you've done what I offered in comment 9. Cool.
Looking good on Linux.
Testing on W10 with Audacity 3.0.0 35e9afe All looks good a) the original steps to reproduce b) the residual I reported in Comment #7 for multiple undos failing
Testing on nacOS 11.1 Big Sur with Audacity 3.0.0 35e9afe All looks good a) the original steps to reproduce b) the residual I reported in Comment #7 for multiple undos failing