MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / handleNormalKey

Method handleNormalKey

internal/tui/config_tab.go:105–148  ·  view source on GitHub ↗
(msg tea.KeyMsg)

Source from the content-addressed store, hash-verified

103}
104
105func (m configTabModel) handleNormalKey(msg tea.KeyMsg) (configTabModel, tea.Cmd) {
106 switch msg.String() {
107 case "r":
108 m.message = ""
109 return m, m.fetchConfig
110 case "up", "k":
111 if m.cursor > 0 {
112 m.cursor--
113 m.viewport.SetContent(m.renderContent())
114 // Ensure cursor is visible
115 m.ensureCursorVisible()
116 }
117 return m, nil
118 case "down", "j":
119 if m.cursor < len(m.fields)-1 {
120 m.cursor++
121 m.viewport.SetContent(m.renderContent())
122 m.ensureCursorVisible()
123 }
124 return m, nil
125 case "enter", " ":
126 if m.cursor >= 0 && m.cursor < len(m.fields) {
127 f := m.fields[m.cursor]
128 if f.kind == "readonly" {
129 return m, nil
130 }
131 if f.kind == "bool" {
132 // Toggle directly
133 return m, m.toggleBool(m.cursor)
134 }
135 // Start editing for int/string
136 m.editing = true
137 m.textInput.SetValue(configFieldEditValue(f))
138 m.textInput.Focus()
139 m.viewport.SetContent(m.renderContent())
140 return m, textinput.Blink
141 }
142 return m, nil
143 }
144
145 var cmd tea.Cmd
146 m.viewport, cmd = m.viewport.Update(msg)
147 return m, cmd
148}
149
150func (m configTabModel) handleEditingKey(msg tea.KeyMsg) (configTabModel, tea.Cmd) {
151 switch msg.String() {

Callers 1

UpdateMethod · 0.95

Calls 6

renderContentMethod · 0.95
ensureCursorVisibleMethod · 0.95
toggleBoolMethod · 0.95
configFieldEditValueFunction · 0.85
StringMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected