! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Add support for CTRL+Z in dialog boxes
Status:
RESOLVED: FIXED
Severity:
enhancement

Comments

Description patrice 2018-12-08 16:27:14 CET
Hi,

When I want to rename a filename into Thunar, a dialog box appears prompting to correct the filename. (Rename 'filename' / Enter the new name).

into edit field, some standard shortcuts works fine ('copy' CTRL+C, 'paste' CTRL+V), but the standard 'undo' CTRL+Z not).

Thanks for your work.

Best regards.
Comment 1 alexxcons editbugs 2018-12-13 10:19:10 CET
Changed to "enhancement" ... dont think there is any field at all in thunar which supports CTRL+Z.

To to be discussed if we generally want that, since afaik it complicates the code alot, which could lead to performance problems / more memory usage.
Thunar is known as a lightweight file browser. So it depends on the impact of the feature if it will be added.

However if I am wrong with my estimation, it would be fine for me to add CTRL+Z support .. patches are always welcome !
Comment 2 patrice 2018-12-13 17:48:43 CET
Hi,

I agree with your comment. Because some standard shortcuts works, I didn't know if CTRL+Z disable is a bug or not. 

When you want to rename a file whit Thunar, the filename without extension is selected, so, if you accidentally hit a key on keyboard (instead arrows keys) before unselect the filename, the filename is erased. It is in this way that I tryed CTRL+Z to undo erase operation.

If this shortcut disable is not a dysfunction, I let you discuss if it is a good idea.  It is conceivable that it is not reasonable to add all features suggested by users and designers must maintain a certain coherence.

Best regards.
Comment 3 Andre Miranda editbugs 2018-12-15 02:04:15 CET
Created attachment 8181 
patch

Unfortunately there is nothing disabled, GtkEntry itself does not support undo/redo operations.
We could extend it as ThunarEntry, however I don't think we should.

@alexxcons, I checked how Nautilus handles this, and it's surprisingly simple, on ctrl+z it just reverts to the current filename, there is no "edits stack". I prepared the attached patch, let me know what you think.
Comment 4 alexxcons editbugs 2018-12-15 22:12:33 CET
@Andre Miranda
Real nice work, IMO that's a fair tradeoff !

Just tested it, works fine for me.

Only some minor things I noticed during review:
- indention of variable declarations in both new methods
- 863: /* check if we don't have a directory here */ --> /* check if we have a directory here */

IMO would be nice to have in the 4.14 branch as well.
Comment 5 Git Bot editbugs 2018-12-16 05:42:48 CET
Andre Miranda referenced this bugreport in commit 812e5675a184fd73d5a5125860e71bd2d1eb006d

Add support for CTRL+Z in rename dialog (Bug #14956)

https://git.xfce.org/xfce/thunar/commit?id=812e5675a184fd73d5a5125860e71bd2d1eb006d
Comment 6 Git Bot editbugs 2018-12-16 05:45:28 CET
Andre Miranda referenced this bugreport in commit 56d1afc1b04591007d5664360b606361ff768ac6

Add support for CTRL+Z in rename dialog (Bug #14956)

https://git.xfce.org/xfce/thunar/commit?id=56d1afc1b04591007d5664360b606361ff768ac6
Comment 7 Git Bot editbugs 2018-12-16 05:59:04 CET
Andre Miranda referenced this bugreport in commit a7d40e5f57b6e5255696a09a95738c0dd2ee4642

Add support for CTRL+Z in rename dialog (Bug #14956)

https://git.xfce.org/xfce/thunar/commit?id=a7d40e5f57b6e5255696a09a95738c0dd2ee4642
Comment 8 Andre Miranda editbugs 2018-12-16 06:02:04 CET
@alexxcons thanks for catching my formatting slips.
I also pushed to 4.12 in case we release 1.6.16 someday.

Bug #14956

Reported by:
patrice
Reported on: 2018-12-08
Last modified on: 2018-12-16

People

Assignee:
Xfce Bug Triage
CC List:
5 users

Version

Version:
1.6.15

Attachments

patch (4.26 KB, patch)
2018-12-15 02:04 CET , Andre Miranda
no flags

Additional information