Dyalog / ride

Cross-platform IDE for Dyalog APL
https://dyalog.github.io/ride
MIT License
206 stars 32 forks source link

Refuse key combos with a sensible message, rather than writing alt+undefined to the config #560

Closed llelf closed 9 months ago

llelf commented 5 years ago

Describe the issue you are having

Cannot assign some (simple) key combinations (e. g. option+N). It is saved as alt+undefined.

Screen Shot 2019-11-06 at 12 10 13GMT+4

Did you connect to an already running interpreter or start the interpreter from RIDE?

from RIDE (but it does not matter)

How do you reproduce the issue?

Set current keyboard layout to Dutch. Open RIDE → Preferences → Shortcuts. Try to assign ⌥N.

Paste the contents of Help → About (Shift+F1)

IDE:
  Version: 4.1.3370
  Platform: MacIntel
  Date: 2019-02-12 16:45:22 +0000
  Git commit: 8bb64a2c1a43822469b4aa1284039f48c0b65503
  Preferences:{
    "autoCloseBrackets":"0",
    "autocompletion":"shell",
    "colourScheme":"lelf",
    "colourSchemes":"[{\"name\":\"lelf\",\"theme\":\"light\",\"styles\":\"asgn=fg:00f com=fg:088 dfn=fg:00f diam=fg:00f err=fg:f00 fn=fg:008 idm=fg:008 kw=fg:800 lnum=fg:008,bg:f,bgo:0 mod=bg:7,bgo:0.25 mtch=bg:ff8,bgo:0.5 norm=bg:f,bgo:1 ns=fg:8 num=fg:8 op1=fg:00f op2=fg:00f par=fg:00f quad=fg:808 qdl=fg:c0c sel=bg:48e,bgo:0.5 semi=fg:00f sqbr=fg:00f srch=bg:f80,bgo:0.5 str=fg:088 tc=bg:d,bgo:1 tcpe=bg:c8c8c8,bgo:1 trad=fg:8 var=fg:8 zld=fg:008 scmd=fg:00f ucmd=fg:00f vtt=bg:ff0 ca=bg:828282,bgo:1,fg:0f0 cm=bg:0,bgo:0.1,fg:0f0 cv=bg:f,bgo:1,fg:0 cvv=bg:0,bgo:1,fg:0ff ma=bg:828282,bgo:1,fg:0ff na=bg:828282,bgo:1,fg:f qor=bg:f00,bgo:1,fg:f dc=bg:e2d3bb,bgo:1\"}]",
    "cursorBlinking":"solid",
    "kbdLocale":"en_US",
    "keys":"{\"ABT\":[],\"AC\":[\"Cmd-K\"],\"AO\":[\"Alt-;\"],\"BK\":[\"Cmd-[\"],\"EP\":[],\"EXP\":[\"Alt-Shift-Up\",\"Shift-Cmd-E\"],\"FD\":[\"Alt-undefined\",\"Cmd-]\"],\"FX\":[\"Cmd-J\"],\"HLP\":[],\"JBK\":[],\"JSC\":[],\"LL\":[\"Ctrl-A\"],\"LN\":[\"Shift-Cmd-N\"],\"LOG\":[],\"NEW\":[],\"NX\":[\"Cmd-G\"],\"PRF\":[\"Cmd-,\"],\"PV\":[\"Shift-Cmd-G\"],\"QCP\":[\"Cmd-\\\\\"],\"QIT\":[\"Cmd-Q\"],\"QT\":[],\"RD\":[\"Alt-Q\"],\"RL\":[\"Ctrl-E\"],\"SC\":[\"Cmd-F\"],\"SI\":[\"Alt-Shift-C\"],\"TL\":[],\"TVB\":[\"Alt-Cmd-S\"],\"TVO\":[\"Alt-Cmd-O\"],\"WI\":[\"Ctrl-C\",\"Ctrl-PauseBreak\"],\"ZMI\":[\"Cmd-=\"],\"ZMO\":[\"Cmd--\"],\"ZMR\":[\"Cmd-0\"],\"PF25\":[],\"PF26\":[],\"PF27\":[],\"PF28\":[],\"PF29\":[],\"PF30\":[],\"PF31\":[],\"PF32\":[],\"PF33\":[],\"PF34\":[],\"PF35\":[]}",
    "lbarOrder":"← +-×÷*⍟⌹○!? |⌈⌊⊥⊤⊣⊢ =≠≤<>≥≡≢ ∨∧⍲⍱ ↑↓⊂⊃⊆⌷⍋⍒ ⍳⍸∊⍷∪∩~ /\\⌿⍀ ,⍪⍴⌽⊖⍉ ¨⍨⍣.∘⍤@ ⍞⎕⍠⌸⌺⌶⍎⍕ ⋄⍝→⍵⍺∇& ¯⍬ ",
    "menu":"# see below for syntax\n\nDyalog                          {mac}\n  About Dyalog             =ABT\n  -\n  Preferences              =PRF\n  -                            \n  Quit                    =QIT\nFile                           {!browser}\n  Oooopen...              =OWS\n  New Session             =NEW\n  Connect...              =CNC\n  -                             {!mac}\n  Quit                    =QIT {!mac}\nEdit\n  Undo                     =UND {!browser}\n  Redo                     =RDO {!browser}\n  -                             {!browser}\n  Cut                      =CT  {!browser}\n  Copy                     =CP  {!browser}\n  Paste                    =PT  {!browser}\n  Select All               =SA  {mac}\n  -                             {!mac&&!browser}\n  Preferences              =PRF {!mac}\nView\n  Show Language Bar        =LBR\n  Show Status Bar          =SBR\n  Show Workspace Explorer  =WSE\n  Show Debug               =DBG\n  Line Wrapping in Session =WRP\n  -                             {!browser}\n  Stops                    =TVB\n  Line Numbers             =LN\n  Outline                  =TVO\n  -                             {!browser}\n  Increase Font Size       =ZMI {!browser}\n  Decrease Font Size       =ZMO {!browser}\n  Reset Font Size          =ZMR {!browser}\n  -                             {!browser}\n  Toggle Full Screen            {!browser}\nWindow\n  Close All Windows        =CAW\nAction\n  Edit                     =ED\n  Trace                    =TC\n  -\n  Clear all trace/stop/monitor =CAM\n  Weak Interrupt           =WI\n  Strong Interrupt         =SI\nHelp\n  Dyalog Help              =http://help.dyalog.com/\n  Documentation Centre     =http://dyalog.com/documentation.htm\n  -\n  Dyalog Website           =http://dyalog.com/\n  MyDyalog                 =https://my.dyalog.com/\n  -\n  Dyalog Forum             =http://www.dyalog.com/forum\n  -                             {!mac}\n  About                    =ABT {!mac}\n\n# Syntax:\n#   &x   access key, alt+x\n#   =CMD command code; some are special:\n#          LBR WRP WSE render as checkboxes\n#   =http://example.com/  open a URL\n#   {}   conditional display, a boolean expression\n#          operators: && || ! ( )\n#          variables: browser mac win\n#   -    separator (when alone)\n#   #    comment\n\n# The =PRF (\"Preferences\") menu item must be present.",
    "minimapRenderCharacters":"0",
    "persistentHistorySize":"1000",
    "prefixKey":"'",
    "prefixMaps":"{\"en_US\":\"C⋄\"}",
    "showEditorToolbar":"0",
    "title":"⍝ {WSID}",
    "zoom":"3",
    "wrap":"1",
    "fold":"0"
  }

Interpreter:
  Version: 17.0.35664
  Platform: Mac-64
  Edition: Unicode/64
  Date: Feb 19 2019 at 01:15:50
e9gille commented 5 years ago

The reason ⌥N fails is that the Dutch layout has registered this combination as a composite key. You can try using a different layout or create your own. I haven't tried it myself, but others suggest the tool Ukelele if you want to create a custom layout.

llelf commented 5 years ago

The reason ⌥N fails is that the Dutch layout has registered this combination as a composite key.

I know. But it’s still a bug.

e9gille commented 5 years ago

Depends how you look at it. Would you prefer to be able to define the shortcut but not be able to trigger it?

Currently, if you switch to a layout that doesn't define the composite key, you can use it to define a shortcut and it will work. If you later switch to the Dutch layout, it will no longer trigger your defined function.

Likewise, if this "bug" was fixed, you could define the keyboard shortcut in the Dutch layout but not use it until you switch to another layout.

I don't know of a way to override the layout composite key from an app. Is this possible?

llelf commented 5 years ago

Depends how you look at it. Would you prefer to be able to define the shortcut but not be able to trigger it?

I would expect it to just work. You can assign such combinations in System Preferences to applications, not to mention Terminal.app.

I would completely understand if that is hard to do in Electron, but please let’s stop pretending it’s not a bug (c'mon, writing alt + undefined to the config?!)

e9gille commented 5 years ago

That was clumsy of me, of course it is an issue. My statements all assume that it isn't possible for an application to override the composite key. I will need to investigate further, but any help is welcome.

abrudz commented 1 year ago

If RIDE cannot override the composite key, it should at least refuse the combo with a sensible message, rather than writing alt+undefined to the config.

e9gille commented 9 months ago

Unsupported shortcuts are no longer registered, fixed in b3ce5d6