Skip to content

Fix 'vtm.*' objects referencing in Lua - #958

Merged
o-sdn-o merged 13 commits into
directvt:masterfrom
o-sdn-o:gui-bridge
Jul 14, 2026
Merged

Fix 'vtm.*' objects referencing in Lua#958
o-sdn-o merged 13 commits into
directvt:masterfrom
o-sdn-o:gui-bridge

Conversation

@o-sdn-o

@o-sdn-o o-sdn-o commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Changes

  • Provide uniform access to keyboard key properties from Lua. Issues in escape key in neovim in latest release #957
    ObjectID/ClassID Role Methods Method description
    keys Keyboard key properties vtm.keys[string key_name] -> key_record Get keyboard key properties.
    Available properties:
    keycode(int): ALL (Abstract Latin Layout) specific key code
    generic(string): Generic key name (no distinction between left/right/numpad)
    virtcod(int): Virtual key code
    scancod(int): Scancode
    extflag(bool): Extended flag (abstract)
    is_editkey(bool): Involvement in text editing
    is_functional(bool): Functional or not
    <config>
        <events>
          <terminal>
              <script=ExclusiveKeyboardMode on="preview: Ctrl-Alt | Alt-Ctrl"/>
              <script="vtm.gear.SetHandled()" on="Esc"/>
              <script                         on="-Esc">
                  vtm.terminal.ClearSelection()
                  -- No more magic key codes (e.g. keycode=118)
                  local EscCode=vtm.keys["Esc"].keycode;
                  -- log("EscCode=", EscCode);
                  vtm.terminal.KeyEvent({ virtcod=0x1b, scancod=1, keystat=1, cluster='\\u{1b}', keycode=EscCode, shifted='\\u{1b}', unshift='\\u{1b}' },
                                        { virtcod=0x1b, scancod=1, keystat=0, cluster='\\u{1b}', keycode=EscCode, shifted='\\u{1b}', unshift='\\u{1b}' })
              </script>
          </terminal>
        </events>
    </config>
  • Fix 'vtm.*' objects referencing in Lua.
    Test:
    <config>
      <events>
          <desktop>
              <script on="F1">
                  local cfg=vtm.config
                  local term=vtm.terminal
                  log("/config/gui/winstate=", cfg["/config/gui/winstate"]);
                  log("term.CodePage()=", term.CodePage());
                  log("term.CodePage=", term.CodePage);
                  log("term=", term);
                  log("terminal.CodePage()=", terminal.CodePage());
                  log("terminal=", terminal);
                  log("vtm.gear=", vtm.gear);
                  log("tostring(term)=", tostring(term))
                  log("tostring(vtm.gear)=", tostring(vtm.gear))
              </script>
          </desktop>
      </events>
    </config>

@o-sdn-o
o-sdn-o merged commit 86b7899 into directvt:master Jul 14, 2026
9 checks passed
@o-sdn-o
o-sdn-o deleted the gui-bridge branch July 14, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant