Skip to content

Commit

Permalink
refactor: unexport modify other keys
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Aug 20, 2024
1 parent ad68fc1 commit 5f7700e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func WithReportFocus() ProgramOption {
func WithEnhancedKeyboard() ProgramOption {
return func(p *Program) {
_WithKittyKeyboard(3)(p)
WithModifyOtherKeys(1)(p)
_WithModifyOtherKeys(1)(p)
}
}

Expand All @@ -281,7 +281,7 @@ func _WithKittyKeyboard(flags int) ProgramOption {
}
}

// WithModifyOtherKeys enables support for the XTerm modifyOtherKeys feature.
// _WithModifyOtherKeys enables support for the XTerm modifyOtherKeys feature.
// This feature allows the terminal to report ambiguous keys as escape codes.
// This is useful for terminals that don't support the Kitty keyboard protocol.
//
Expand All @@ -293,21 +293,21 @@ func _WithKittyKeyboard(flags int) ProgramOption {
// and Meta-<key>
//
// See https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys
func WithModifyOtherKeys(mode int) ProgramOption {
func _WithModifyOtherKeys(mode int) ProgramOption {
return func(p *Program) {
p.modifyOtherKeys = mode
p.startupOptions |= withModifyOtherKeys
}
}

// WithWindowsInputMode enables Windows Input Mode (win32-input-mode) which
// _WithWindowsInputMode enables Windows Input Mode (win32-input-mode) which
// allows for more advanced input handling and reporting. This is experimental
// and may not work on all terminals.
//
// See
// https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md
// for more information.
func WithWindowsInputMode() ProgramOption {
func _WithWindowsInputMode() ProgramOption {
return func(p *Program) {
p.startupOptions |= withWindowsInputMode
p.win32Input = true
Expand Down
2 changes: 1 addition & 1 deletion parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func parseCsi(b []byte) (int, Msg) {
case 'm' | '>'<<parser.MarkerShift:
// XTerm modifyOtherKeys
if paramsLen == 2 && csi.Param(0) == 4 && csi.Param(1) != -1 {
return i, ModifyOtherKeysMsg(csi.Param(1))
return i, modifyOtherKeysMsg(csi.Param(1))
}
case 'I':
return i, FocusMsg{}
Expand Down
16 changes: 8 additions & 8 deletions xterm.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ type setModifyOtherKeysMsg int
// and Meta-<key>
//
// See https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys
func EnableModifyOtherKeys(mode int) Cmd {
func enableModifyOtherKeys(mode int) Cmd {
return func() Msg {
return setModifyOtherKeysMsg(mode)
}
}

// DisableModifyOtherKeys is a command to disable XTerm modifyOtherKeys mode.
func DisableModifyOtherKeys() Msg {
// disableModifyOtherKeys is a command to disable XTerm modifyOtherKeys mode.
func disableModifyOtherKeys() Msg {
return setModifyOtherKeysMsg(0)
}

Expand Down Expand Up @@ -56,23 +56,23 @@ func parseXTermModifyOtherKeys(csi *ansi.CsiSequence) Msg {
// modifyOtherKeys mode.
type modifyOtherKeys struct{}

// ModifyOtherKeys is a command that queries the terminal for its
// _ModifyOtherKeys is a command that queries the terminal for its
// modifyOtherKeys mode.
func ModifyOtherKeys() Msg {
func _ModifyOtherKeys() Msg {
return modifyOtherKeys{}
}

// ModifyOtherKeysMsg is a message that represents XTerm modifyOtherKeys
// modifyOtherKeysMsg is a message that represents XTerm modifyOtherKeys
// report. Querying the terminal for the modifyOtherKeys mode will return a
// ModifyOtherKeysMsg message with the current mode set.
// modifyOtherKeysMsg message with the current mode set.
//
// 0: disable
// 1: enable mode 1
// 2: enable mode 2
//
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_
// See: https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys
type ModifyOtherKeysMsg uint8
type modifyOtherKeysMsg uint8

// TerminalVersionMsg is a message that represents the terminal version.
type TerminalVersionMsg string
Expand Down

0 comments on commit 5f7700e

Please sign in to comment.