How do I override broken Windows Consistent User Interface standard (CUI) cut behaviour in Discord?

An unfixed bug in a recent version of Discord means that Shift+Del now deletes rather than cuts text, and I've been getting increasingly annoyed at losing text because of my natural instinct to use Shift+Del to cut text rather than Ctrl+X.

I forget that it's not working, cut the text in the way I've always done, and go to paste it elsewhere, only to find that while the text is gone in it's original location, and it isn't in the paste buffer. If I haven't done anything else, I can often Ctrl+Z to get the text back, but if I've done too much, that doesn't work.

Shift+Del works fine with other applications, so is there any way to disable this unwanted keyboard shortcut override in Discord at the OS level, and restore the expected behaviour where Shift+Del is synonymous with Ctrl+X?

Discord Stable 101451 (b46c230) Host 1.0.9003 Windows 10 64-Bit (10.0.19041)

According to Eldritch Conundrum in comments, this problem is also seen with Discord on Linux.


Solution 1:

Discord on Windows

After reading harrymc's answer, and reading the documentation, I found that the following AutoHotkey script was able to fix the Shift+Del behaviour in Discord:

#IfWinActive ahk_exe Discord.exe
+Del::
Send, {Ctrl down}x{Ctrl up}

It seems that when the documentation says this method is more secure it can also mean this can work in situations where the other method doesn't.

I don't know why harrymc's solution didn't work for Discord, but my suspicion is that something about Discords input handling means that +Del::^x resulted in the broken Shift+Del behaviour being suppressed rather than it being fix, it just seems to ignore AutoHotkeys ^x instruction, and it's probably the same reason for the Shift+Del behaviour breaking in the first place.

Discord on Linux

Although originally about Discord on Windows, Eldritch Conundrum said they had the same problem on Linux. According to suggestions in AutoHotkey equivalent on Unix & Linux Stack Exchange it's possible that IronAHK, sikuli, AutoKey, xautomation or AutoHotkey under Wine might help solve this problem on Linux.

Solution 2:

You can use the free AutoHotkey.

To replace Shift+Del by Ctrl+X, but only in Discord, you could use this AutoHotkey script:

#IfWinActive ahk_exe Discord.exe
+Del::^x

After installing AutoHotKey, put the script in a .ahk file and double-click it to test. You may stop the script by right-click on the green H icon in the traybar and choosing Exit. To have it run on login, place it in the Startup group at C:\Users\USER-NAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup.

Useful AutoHotkey documentation:

  • List of Keys
  • Hotkeys