From 5b6196ebe67cf954bae8212c1a33b869da723e11 Mon Sep 17 00:00:00 2001 From: raven Date: Fri, 20 Feb 2026 13:42:12 -0600 Subject: support builtin terminfo copy termfo into the repository and modify it to embed an xterm terminfo to as a fallback --- tui/termfo/keys/keys.go | 120 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 tui/termfo/keys/keys.go (limited to 'tui/termfo/keys/keys.go') diff --git a/tui/termfo/keys/keys.go b/tui/termfo/keys/keys.go new file mode 100644 index 0000000..fe2424c --- /dev/null +++ b/tui/termfo/keys/keys.go @@ -0,0 +1,120 @@ +// Code generated by term.h.zsh; DO NOT EDIT. + +package keys + +import "citrons.xyz/talk/tui/termfo/caps" + +// CursesVersion is the version of curses this data was generated with, as [implementation]-[version]. +const CursesVersion = `ncurses-6.5.20240511` + +// Keys maps caps.Cap to Key constants +var Keys = map[*caps.Cap]Key{ + caps.TableStrs[55]: Backspace, + caps.TableStrs[59]: Delete, + caps.TableStrs[61]: Down, + caps.TableStrs[66]: F1, + caps.TableStrs[67]: F10, + caps.TableStrs[68]: F2, + caps.TableStrs[69]: F3, + caps.TableStrs[70]: F4, + caps.TableStrs[71]: F5, + caps.TableStrs[72]: F6, + caps.TableStrs[73]: F7, + caps.TableStrs[74]: F8, + caps.TableStrs[75]: F9, + caps.TableStrs[76]: Home, + caps.TableStrs[77]: Insert, + caps.TableStrs[79]: Left, + caps.TableStrs[81]: PageDown, + caps.TableStrs[82]: PageUp, + caps.TableStrs[83]: Right, + caps.TableStrs[87]: Up, + caps.TableStrs[148]: BackTab, + caps.TableStrs[164]: End, + caps.TableStrs[165]: Enter, + caps.TableStrs[191]: ShiftDelete, + caps.TableStrs[194]: ShiftEnd, + caps.TableStrs[199]: ShiftHome, + caps.TableStrs[200]: ShiftInsert, + caps.TableStrs[201]: ShiftLeft, + caps.TableStrs[210]: ShiftRight, + caps.TableStrs[216]: F11, + caps.TableStrs[217]: F12, + caps.TableStrs[355]: Mouse, +} + +// List of all key sequences we know about. This excludes most obscure ones not +// present on modern devices. +const ( + // Special key used to signal errors. + UnknownSequence Key = iota + (1 << 32) + + ShiftLeft + PageUp + Insert + ShiftInsert + Up + Right + F1 + ShiftRight + F2 + ShiftHome + F3 + Delete + PageDown + F4 + F10 + F11 + ShiftDelete + F5 + Down + Mouse + F12 + ShiftEnd + F6 + Enter + Left + F7 + End + F8 + F9 + Backspace + BackTab + Home +) + +// Names of named key constants. +var keyNames = map[Key]string{ + ShiftLeft: `ShiftLeft`, + PageUp: `PageUp`, + Insert: `Insert`, + ShiftInsert: `ShiftInsert`, + Up: `Up`, + Right: `Right`, + F1: `F1`, + ShiftRight: `ShiftRight`, + F2: `F2`, + ShiftHome: `ShiftHome`, + F3: `F3`, + Delete: `Delete`, + PageDown: `PageDown`, + F4: `F4`, + F10: `F10`, + F11: `F11`, + ShiftDelete: `ShiftDelete`, + F5: `F5`, + Down: `Down`, + Mouse: `Mouse`, + F12: `F12`, + ShiftEnd: `ShiftEnd`, + F6: `F6`, + Enter: `Enter`, + Left: `Left`, + F7: `F7`, + End: `End`, + F8: `F8`, + F9: `F9`, + Backspace: `Backspace`, + BackTab: `BackTab`, + Home: `Home`, +} -- cgit v1.2.3