Switch to c++

This commit is contained in:
2025-12-07 17:22:12 +00:00
parent 2927df7710
commit 7acf35c8ea
55 changed files with 3506 additions and 304 deletions

67
__old__/utils.rb Normal file
View File

@@ -0,0 +1,67 @@
Fold = Struct.new(:start, :end, :active, :crc32)
Highlight = Struct.new(:color_fg, :color_bg, :flags, :priority)
Token = Struct.new(:start, :end, :sym)
CF_NONE = 0b00000000
CF_ITALIC = 0b00000001
CF_BOLD = 0b00000010
CF_UNDERLINE = 0b00000100
def ctrl_key(k)
k.ord & 0x1F
end
# Key types
KEY_TYPE = {
0 => :char,
1 => :special,
2 => :mouse,
3 => :none
}.freeze
# Special keys
SPECIAL_KEY = {
0 => :up,
1 => :down,
2 => :left,
3 => :right,
4 => :delete
}.freeze
# Control key
KEY_ESC = "\x1b".freeze
# Mouse states
MOUSE_STATE = {
0 => :press,
1 => :release,
2 => :drag,
3 => :scroll
}.freeze
# Mouse buttons
MOUSE_BUTTON = {
0 => :left,
1 => :middle,
2 => :right,
3 => :scroll,
4 => :none
}.freeze
# Scroll directions
SCROLL_DIR = {
0 => :up,
1 => :down,
2 => :left,
3 => :right,
4 => :none
}.freeze
# Modifiers
MODIFIER = {
0 => :none,
1 => :alt,
2 => :cntrl,
3 => :cntrl_alt,
4 => :shift
}.freeze