Skip to content

Commit

Permalink
fix: simplify kitty keyboard msg flags
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Aug 19, 2024
1 parent ec5b362 commit c630d5e
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions kitty.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,18 @@ func DisableEnhancedKeyboard() Msg {
// KittyKeyboardMsg represents Kitty keyboard progressive enhancement flags message.
type KittyKeyboardMsg int

// HasDisambiguateEscapeCodes returns true if the DisambiguateEscapeCodes flag is set.
func (e KittyKeyboardMsg) HasDisambiguateEscapeCodes() bool {
return e&ansi.KittyDisambiguateEscapeCodes != 0
}

// HasReportEventTypes returns true if the ReportEventTypes flag is set.
func (e KittyKeyboardMsg) HasReportEventTypes() bool {
return e&ansi.KittyReportEventTypes != 0
}

// HasReportAlternateKeys returns true if the ReportAlternateKeys flag is set.
func (e KittyKeyboardMsg) HasReportAlternateKeys() bool {
return e&ansi.KittyReportAlternateKeys != 0
}

// HasReportAllKeys returns true if the ReportAllKeys flag is set.
func (e KittyKeyboardMsg) HasReportAllKeys() bool {
return e&ansi.KittyReportAllKeys != 0
}
// Kitty Keyboard Protocol flags.
const (
KittyDisambiguateEscapeCodes KittyKeyboardMsg = 1 << iota
KittyReportEventTypes
KittyReportAlternateKeys
KittyReportAllKeys
KittyReportAssociatedKeys
)

// HasReportAssociatedKeys returns true if the ReportAssociatedKeys flag is set.
func (e KittyKeyboardMsg) HasReportAssociatedKeys() bool {
return e&ansi.KittyReportAssociatedKeys != 0
// Contains reports whether m contains the given flags.
func (m KittyKeyboardMsg) Contains(flags KittyKeyboardMsg) bool {
return m&flags == flags
}

// Kitty Clipboard Control Sequences
Expand Down

0 comments on commit c630d5e

Please sign in to comment.