better support other keyboard layouts

akkartik
Apr 1, 2026, 6:32 PM
A7MKM5XLXTAJH34NI5L5N52N3QPUQMLZCYU2ZKOHN7X4LFZESAHQC

Dependencies

  • [2] A27WWJ6H document a few more keyboard primitives
  • [3] 3GITFJZK fix a comment
  • [4] BKX2TYUG use cmd key on Mac OS for some idiomatic shortcuts
  • [5] 3HDWCPDI bugfix: include shift keys in modifier_down
  • [6] ZLJGZYQG select text with shift + mouseclick
  • [7] MTJEVRJR add state arg to a few functions
  • [8] UGLYKBDA fix tests on Mac OS
  • [9] ETM7ENJR some helpers
  • [10] 2CK5QI7W make love event names consistent
  • [11] KKMFQDR4 editing source code from within the app
  • [12] 6LJZN727 handle chords
  • [13] BYG5CEMV support for naming points
  • [14] O4ZGUPZN improved handling of other keyboard layouts
  • [15] 4QQBMWLL regression: typing uppercase letters in text
  • [16] N2NUGNN4 include a brief reference enabling many useful apps
  • [17] GIG6OV3G port keyboard layout handling to source editor
  • [18] 3MAZEQK5 add state arg to Text.textinput
  • [19] DRFE3B3Z mouse buttons are integers, not strings
  • [20] 5UG5PQ6K undo commit 861c57b533
  • [21] 7IDHIAYI rename modifier_down to key_down
  • [22] G6OYAYHU paste in text with M-v
  • [23] XDB5D7H7 some early returns should be asserts
  • [*] BULPIBEG beginnings of a module for the text editor
  • [*] FS2ITYYH record a known issue
  • [*] UEE5W7WJ document one more shortcut
  • [*] BH7BT36L ctrl+a: select entire buffer

Change contents

  • replacement in text.lua at line 146
    [5.1182][5.4:66](),[5.66][3.4:79](),[3.79][5.143:234](),[5.143][5.143:234]()
    if App.any_modifier_down() then
    if App.key_down(t) then
    -- The modifiers didn't change the key. Handle it in keychord_press.
    return
    else
    -- Key mutated by the keyboard layout. Continue below.
    end
    [5.1182]
    [5.234]
    -- textinput events can occur on chords with the shift key or AltGr key
    -- but not for ctrl, alt or cmd/super/gui
    if App.ctrl_down() or App.alt_down() or App.cmd_down() then
    return
  • replacement in source_text.lua at line 223
    [5.97177][5.8:70](),[5.70][3.84:159](),[3.159][5.147:238](),[5.147][5.147:238]()
    if App.any_modifier_down() then
    if App.key_down(t) then
    -- The modifiers didn't change the key. Handle it in keychord_press.
    return
    else
    -- Key mutated by the keyboard layout. Continue below.
    end
    [5.97177]
    [5.238]
    -- textinput events can occur on chords with the shift key or AltGr key
    -- but not for ctrl, alt or cmd/super/gui
    if App.ctrl_down() or App.alt_down() or App.cmd_down() then
    return
  • edit in reference.md at line 342
    [2.261][2.261:360]()
    * `App.any_modifier_down()` -- returns `true` if any of the modifier keys is
    currently pressed.
  • replacement in keychord.lua at line 46
    [4.826][5.1663:1696](),[5.258][5.1663:1696](),[5.1696][5.186:267](),[5.287][5.186:267]()
    function App.any_modifier_down()
    return App.ctrl_down() or App.alt_down() or App.shift_down() or App.cmd_down()
    [4.826]
    [5.5]
    -- Many keyboard layouts use a special altGr key to insert additional
    -- printable characters. SDL/LÖVE can't represent altGr distinctly.
    function alt_gr_down()
    return App.key_down('ralt')
  • edit in keychord.lua at line 52
    [5.10]
    [5.10]
    -- altGr is a separate modifier and never considered with alt or ctrl,
    -- regardless of layout.
  • edit in keychord.lua at line 55
    [5.35]
    [5.102]
    if alt_gr_down() then return false end
  • edit in keychord.lua at line 60
    [5.136]
    [5.159]
    if alt_gr_down() then return false end
  • edit in README.md at line 37
    [27.91]
    [28.665]
    Only left alt is supported, because many keyboard layouts use right alt like
    shift for typing characters, and I don't know how to figure out the current
    layout.