[Feature] Undo for the Editor
Moderators: Hacker, petermad, Stefan2, white
-
- Junior Member
- Posts: 13
- Joined: 2011-07-29, 07:22 UTC
[Feature] Undo for the Editor
I am missing an Undo function in the TC editor.
Yesterday, I wrote a long text in Total Commander's editor and after finishing the text, when I wanted to copy and paste it to somewhere else, I accidentally chose "Paste" first (not copy) and thereby replaced the whole text by the contents of the clipboard.
An Undo function in Total Commander's editor would have been exactly what I needed to fix that mistake.
Yesterday, I wrote a long text in Total Commander's editor and after finishing the text, when I wanted to copy and paste it to somewhere else, I accidentally chose "Paste" first (not copy) and thereby replaced the whole text by the contents of the clipboard.
An Undo function in Total Commander's editor would have been exactly what I needed to fix that mistake.
Simple Undo in Editor is implemented in latest TC betas, but currently only for Android 6 and newer (I don't know whether it is planned or even possible to add it for previous Android versions). So if you have a compatible Android device, you can try it with current TC4A 2.81 beta 10 (Google Play/APK)
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Ukraine's National Bank special bank account:
UA843000010000000047330992708
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
It only support on Android 6 and newer because that's when Google added it to their edit control.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
It's in this post :
viewtopic.php?t=49670
viewtopic.php?t=49670
ghisler(Author) wrote:Unfortunately Undo is very limited in the Android edit control: It is only available after
- typing
- pasting text
- deleting text
and it can only undo a single step.
You need to open the edit box context menu to see it. On some devices, you get this by long tapping on a word. On others, it appears when you double tap. Then there will appear an arrow which points to the left and forms an arc (a bit like a rainbow in shape) as the first menu item. If it is missing, then undo is not available at the moment, or not supported.
Re: [Feature] Undo for the Editor
I don't have an undo button in my context menu, but if I switch to a keyboard with a "Control" key (like "Hackers Keyboard"), I can use CTRL+z.
Total Commander 3.24
Android 7.0
Huawei tablet with EMUI 5.1.2
Total Commander 3.24
Android 7.0
Huawei tablet with EMUI 5.1.2
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: [Feature] Undo for the Editor
Do you mean in the editor? TC should add a curved right to left arrow when there is no undo menu item in the context menu.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: [Feature] Undo for the Editor
Yeah - the TC text editor.
No "undo" button or context menu item.
No "undo" button or context menu item.
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: [Feature] Undo for the Editor
Your EMUI version is probably too old. My Huawei tablet Mediapad M5 (model SHT-W09) has EMUI 9.1.0 and shows the Undo context menu item.
I'm loading the (private) editor method "canUndo" to check whether the current edit box allows Undo or not. This doesn't seem to work on your device.
I'm loading the (private) editor method "canUndo" to check whether the current edit box allows Undo or not. This doesn't seem to work on your device.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
-
- Junior Member
- Posts: 13
- Joined: 2011-07-29, 07:22 UTC
Re: [Feature] Undo for the Editor
On my Samsung Galaxy A55 5G (Android 14, One UI 6.1), the TC editor shows no undo button (curved right to left arrow), which is to be expected, because I can find an undo option in the context menu when I am editing.
I want to point out the following:
1.)
This solution works, but it feels unconventional. Typically, the context menu in an editor is designed to provide options relevant to the selected text or the current cursor position, such as copy, cut, or "paste here." Including a general operation like "undo" in the context menu seems out of place, as it doesn’t directly relate to the selected text or cursor location.
That said, I acknowledge there’s another general operation in the context menu—"Select All"—which could be subject to the same critique. However, I think it makes sense in this case because it closely ties to other context menu actions like copy, cut, and paste, effectively functioning as a required preparation for "overwrite everything while pasting" in that case.
2.)
Why does TC show the undo button only when the context menu lacks an undo option? Considering the reasoning mentioned earlier, I would recommend always displaying an undo button or an overflow menu entry in the TC editor to enhance usability.
The Hacker's Keyboard demonstrates that it's entirely feasible to trigger an undo action universally. I confirmed this on my device by pressing Ctrl+Z, without relying on a context menu. You can see this in the image linked below:
Image: https://jsam.info/perma/20241208_TotalCommander_HackersKeyboard_Ctrl-z.jpg
I want to point out the following:
1.)
This solution works, but it feels unconventional. Typically, the context menu in an editor is designed to provide options relevant to the selected text or the current cursor position, such as copy, cut, or "paste here." Including a general operation like "undo" in the context menu seems out of place, as it doesn’t directly relate to the selected text or cursor location.
That said, I acknowledge there’s another general operation in the context menu—"Select All"—which could be subject to the same critique. However, I think it makes sense in this case because it closely ties to other context menu actions like copy, cut, and paste, effectively functioning as a required preparation for "overwrite everything while pasting" in that case.
2.)
Why does TC show the undo button only when the context menu lacks an undo option? Considering the reasoning mentioned earlier, I would recommend always displaying an undo button or an overflow menu entry in the TC editor to enhance usability.
The Hacker's Keyboard demonstrates that it's entirely feasible to trigger an undo action universally. I confirmed this on my device by pressing Ctrl+Z, without relying on a context menu. You can see this in the image linked below:
Image: https://jsam.info/perma/20241208_TotalCommander_HackersKeyboard_Ctrl-z.jpg
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: [Feature] Undo for the Editor
1.) I put the undo button in there for devices missing the "Undo" option. Since more recent devices have the option there, I thought that it would be best to put it there also for older devices.
2.) I could have removed the "Undo" option an replaced it with an undo button, but then it would no longer be consistent with other apps on the same phone.
2.) I could have removed the "Undo" option an replaced it with an undo button, but then it would no longer be consistent with other apps on the same phone.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com