Error sound when rename operation is aborted

Bug reports will be moved here when the described bug has been fixed

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
Dalai
Power Member
Power Member
Posts: 9968
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Error sound when rename operation is aborted

Post by *Dalai »

Hey there.

Yesterday I discovered a small bug by accident. Steps to reproduce:
  1. Choose any file or directory and set the cursor on it
  2. Use Shift+F6 to start the rename operation. If your file has an extension, make sure the whole file name is selected.
  3. Type a single space character
  4. Abort the operation by ESC => Windows error sound is played.
Expected: TC shouldn't play anything when the rename operation is aborted. I checked this on TC 8.52a and TC9 (both 32 and 64 bit) on XP and Win7 x64, it happens on all of them. I haven't found any other characters that trigger the sound so far, even two space characters don't.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
p.eter
Junior Member
Junior Member
Posts: 35
Joined: 2013-04-18, 08:43 UTC

Post by *p.eter »

I don't know if it's a bug, but i can confirm this behavior
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50550
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Yes, when the name field contains an invalid name, TC beeps when you close the rename dialog, whether you press ENTER or ESC.
Author of Total Commander
https://www.ghisler.com
User avatar
Dalai
Power Member
Power Member
Posts: 9968
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

2ghisler(Author)
No, it doesn't work that way. At first, I had the same thought, but I tried with invalid characters as well like backslash, slash, colon and so on and TC never played the error sound. And, why is it played only when one space is used but not when there's two or more of them? It's invalid in either case.

And, as I said: TC shouldn't play anything when the operation is aborted, it's superfluous and annoying.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50550
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Here is the code I found:

Code: Select all

  if RenameReason and (wtoname[0]=#0) or (wstrcomp(wtoname,' '#0)=0) then begin
    Messagebeep(mb_iconstop);
    reason:=goEscape;
    RenameReason:=false;
  end;
I must have added it because renaming to space or empty string must have been causing some kind of disaster - I really don't remember...
Author of Total Commander
https://www.ghisler.com
User avatar
Dalai
Power Member
Power Member
Posts: 9968
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

Mmh, that explains why the sound is played on a name with a single space, but I can't reproduce it with an empty name - which your code suggests if I understand it correctly.

But I still don't get why the sound is played in the first place when the operation is canceled. That doesn't make any sense, does it? Software should only call for the user's attention when necessary, if the user made some mistake. In this case, the user already knows, so (s)he didn't confirm the new name.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50550
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

It was a problem of missing braces, I will fix it. The correct form would be:

Code: Select all

if RenameReason and ((wtoname[0]=#0) or (wstrcomp(wtoname,' '#0)=0)) then begin
Author of Total Commander
https://www.ghisler.com
User avatar
Dalai
Power Member
Power Member
Posts: 9968
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

history.txt wrote:05.08.16 Fixed: Beep sound was played when renaming and ESC was pressed with a single space in the edit box (32/64)
Confirm the fix, thanks!

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Post Reply