DRYer
This commit is contained in:
parent
509a45b579
commit
bf773351ed
@ -134,30 +134,21 @@ func NoAlternateScreen(self *Loop) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *Loop) OnlyDisambiguateKeys() *Loop {
|
func (self *Loop) OnlyDisambiguateKeys() *Loop {
|
||||||
self.terminal_options.kitty_keyboard_mode = 0b1
|
self.terminal_options.kitty_keyboard_mode = DISAMBIGUATE_KEYS
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
func OnlyDisambiguateKeys(self *Loop) {
|
func OnlyDisambiguateKeys(self *Loop) {
|
||||||
self.terminal_options.kitty_keyboard_mode = 0b1
|
self.terminal_options.kitty_keyboard_mode = DISAMBIGUATE_KEYS
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Loop) FullKeyboardProtocol() *Loop {
|
func (self *Loop) FullKeyboardProtocol() *Loop {
|
||||||
self.terminal_options.kitty_keyboard_mode = 0b11111
|
self.terminal_options.kitty_keyboard_mode = FULL_KEYBOARD_PROTOCOL
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
func FullKeyboardProtocol(self *Loop) {
|
func FullKeyboardProtocol(self *Loop) {
|
||||||
self.terminal_options.kitty_keyboard_mode = 0b11111
|
self.terminal_options.kitty_keyboard_mode = FULL_KEYBOARD_PROTOCOL
|
||||||
}
|
|
||||||
|
|
||||||
func (self *Loop) FullKeyboardProtocolWithoutReleaseEvents() *Loop {
|
|
||||||
self.terminal_options.kitty_keyboard_mode = 0b11101
|
|
||||||
return self
|
|
||||||
}
|
|
||||||
|
|
||||||
func FullKeyboardProtocolWithoutReleaseEvents(self *Loop) {
|
|
||||||
self.terminal_options.kitty_keyboard_mode = 0b11101
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Loop) MouseTrackingMode(mt MouseTracking) *Loop {
|
func (self *Loop) MouseTrackingMode(mt MouseTracking) *Loop {
|
||||||
|
|||||||
@ -24,7 +24,7 @@ func new_loop() *Loop {
|
|||||||
l := Loop{controlling_term: nil, timers_temp: make([]*timer, 4)}
|
l := Loop{controlling_term: nil, timers_temp: make([]*timer, 4)}
|
||||||
l.terminal_options.alternate_screen = true
|
l.terminal_options.alternate_screen = true
|
||||||
l.terminal_options.restore_colors = true
|
l.terminal_options.restore_colors = true
|
||||||
l.terminal_options.kitty_keyboard_mode = 0b11101 // full protocol without release and repeat events
|
l.terminal_options.kitty_keyboard_mode = DISAMBIGUATE_KEYS | REPORT_ALTERNATE_KEYS | REPORT_ALL_KEYS_AS_ESCAPE_CODES | REPORT_TEXT_WITH_KEYS
|
||||||
l.escape_code_parser.HandleCSI = l.handle_csi
|
l.escape_code_parser.HandleCSI = l.handle_csi
|
||||||
l.escape_code_parser.HandleOSC = l.handle_osc
|
l.escape_code_parser.HandleOSC = l.handle_osc
|
||||||
l.escape_code_parser.HandleDCS = l.handle_dcs
|
l.escape_code_parser.HandleDCS = l.handle_dcs
|
||||||
|
|||||||
@ -9,6 +9,17 @@ import (
|
|||||||
"kitty"
|
"kitty"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type KeyboardStateBits uint8
|
||||||
|
|
||||||
|
const (
|
||||||
|
DISAMBIGUATE_KEYS KeyboardStateBits = 1 << iota
|
||||||
|
REPORT_KEY_EVENT_TYPES
|
||||||
|
REPORT_ALTERNATE_KEYS
|
||||||
|
REPORT_ALL_KEYS_AS_ESCAPE_CODES
|
||||||
|
REPORT_TEXT_WITH_KEYS
|
||||||
|
FULL_KEYBOARD_PROTOCOL = DISAMBIGUATE_KEYS | REPORT_ALTERNATE_KEYS | REPORT_ALL_KEYS_AS_ESCAPE_CODES | REPORT_TEXT_WITH_KEYS | REPORT_KEY_EVENT_TYPES
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SAVE_CURSOR = "\0337"
|
SAVE_CURSOR = "\0337"
|
||||||
RESTORE_CURSOR = "\0338"
|
RESTORE_CURSOR = "\0338"
|
||||||
@ -86,7 +97,7 @@ const (
|
|||||||
type TerminalStateOptions struct {
|
type TerminalStateOptions struct {
|
||||||
alternate_screen, restore_colors bool
|
alternate_screen, restore_colors bool
|
||||||
mouse_tracking MouseTracking
|
mouse_tracking MouseTracking
|
||||||
kitty_keyboard_mode int
|
kitty_keyboard_mode KeyboardStateBits
|
||||||
}
|
}
|
||||||
|
|
||||||
func set_modes(sb *strings.Builder, modes ...Mode) {
|
func set_modes(sb *strings.Builder, modes ...Mode) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user