···7373* `ctrl+z` to undo, `ctrl+y` to redo
7474* `ctrl+=` to zoom in, `ctrl+-` to zoom out, `ctrl+0` to reset zoom
7575* `alt+right`/`alt+left` to jump to the next/previous word, respectively
7676+ Only left alt is supported, because many keyboard layouts use right alt like
7777+ shift for typing characters, and I don't know how to figure out the current
7878+ layout.
7679* mouse drag or `shift` + movement to select text, `ctrl+a` to select all
77807881Exclusively tested so far with a US keyboard layout. If
+3-2
edit.lua
···688688 return
689689 end
690690 if move.to_coord(editor, editor.cursor) == nil then return end -- cursor is off screen
691691- if keychord.any_modifier_down() and key_down(t) then
692692- -- The modifiers didn't change the key. Handle it in keychord_press.
691691+ -- textinput events can occur on chords with the shift key or AltGr key
692692+ -- but not for ctrl, alt or cmd/super/gui
693693+ if keychord.ctrl_down() or keychord.alt_down() or keychord.cmd_down() then
693694 return
694695 end
695696 if not readonly then
+8-2
keychord.lua
···4747 end
4848end
49495050-function keychord.any_modifier_down()
5151- return keychord.ctrl_down() or keychord.alt_down() or keychord.shift_down() or keychord.cmd_down()
5050+-- Many keyboard layouts use a special altGr key to insert additional
5151+-- printable characters. SDL/LÖVE can't represent altGr distinctly.
5252+function I.alt_gr_down()
5353+ return key_down('ralt')
5254end
53555656+-- altGr is a separate modifier and never considered with alt or ctrl,
5757+-- regardless of layout.
5458function keychord.ctrl_down()
5959+ if I.alt_gr_down() then return false end
5560 return key_down('lctrl') or key_down('rctrl')
5661end
57625863function keychord.alt_down()
6464+ if I.alt_gr_down() then return false end
5965 return key_down('lalt') or key_down('ralt')
6066end
6167
+2-1
reference.md
···8787 Provides in `chord` a string representation of the current key combination,
8888 consisting of the key with the following prefixes:
8989 * `C-` if one of the `ctrl` keys is pressed,
9090- * `M-` if one of the `alt` keys is pressed,
9090+ * `M-` if the left `alt` key is pressed (right alt has other meanings in
9191+ some keyboard layouts, so we never check for it),
9192 * `S-` if one of the `shift` keys is pressed, and
9293 * `s-` if the `windows`/`cmd`/`super` key is pressed.
9394