[Feature] Undo for the Editor

Support for Android version of Total Commander

Moderators: Hacker, petermad, Stefan2, white

Post Reply
DärJohannes
Junior Member
Junior Member
Posts: 13
Joined: 2011-07-29, 07:22 UTC

[Feature] Undo for the Editor

Post by *DärJohannes »

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.
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

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
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

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
sjlouis
Junior Member
Junior Member
Posts: 34
Joined: 2016-10-19, 11:04 UTC

Post by *sjlouis »

How can we activate this function? I don't find it and I'm on Androïd 7.1.

Thank you :D .

Ok, I've found it on another post :wink: .
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

sjlouis wrote:Ok, I've found it on another post :wink: .
And how about posting the URL to that post or the solution itself?

Taking and Giving, you know?




 
sjlouis
Junior Member
Junior Member
Posts: 34
Joined: 2016-10-19, 11:04 UTC

Post by *sjlouis »

It's in this post :
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.
Lee321987
Junior Member
Junior Member
Posts: 10
Joined: 2021-12-10, 21:44 UTC

Re: [Feature] Undo for the Editor

Post by *Lee321987 »

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
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [Feature] Undo for the Editor

Post by *ghisler(Author) »

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
Lee321987
Junior Member
Junior Member
Posts: 10
Joined: 2021-12-10, 21:44 UTC

Re: [Feature] Undo for the Editor

Post by *Lee321987 »

Yeah - the TC text editor.
No "undo" button or context menu item.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [Feature] Undo for the Editor

Post by *ghisler(Author) »

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.
Author of Total Commander
https://www.ghisler.com
DärJohannes
Junior Member
Junior Member
Posts: 13
Joined: 2011-07-29, 07:22 UTC

Re: [Feature] Undo for the Editor

Post by *DärJohannes »

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
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [Feature] Undo for the Editor

Post by *ghisler(Author) »

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.
Author of Total Commander
https://www.ghisler.com
Post Reply