diff --git a/internal/tui/components/chat/editor/editor.go b/internal/tui/components/chat/editor/editor.go index 1e8c1bc9748bc3392c4ba40b3832db7981dbc3e9..1d16aecd28b52a038e8368e9b1ccb58c19f27260 100644 --- a/internal/tui/components/chat/editor/editor.go +++ b/internal/tui/components/chat/editor/editor.go @@ -536,74 +536,6 @@ func (m *editorCmp) getUserMessagesAsText() ([]string, error) { return userMessages, nil } -/* -type direction int - -const ( - previous = iota - next -) - -func (m *editorCmp) getDirectionFromKey(msg tea.KeyPressMsg) func() direction { - return func() direction { - if key.Matches(msg, m.keyMap.Previous) { - return previous - } - return next - } -} - -func (m *editorCmp) stepOverHistory(resolveHistoricMessages func(context.Context) ([]string, error), resolveDirection func() direction) string { - // NOTE(tauraamui): the last entry in this list will be the current contents of the input field/box - messageHistory, err := resolveHistoricMessages(context.Background()) - if err != nil { - return "" - } - - // the list will/should always have at least the current message in the input in the list - if len(messageHistory) == 1 { - return messageHistory[0] - } - - // the first time we invoke scroll we need to start from top of the list - if !m.previouslyScrollingPromptHistory { - m.promptHistoryIndex = len(messageHistory) - 1 - m.previouslyScrollingPromptHistory = true - } - - switch resolveDirection() { - case previous: - return m.stepBack(messageHistory) - case next: - return m.stepForward(messageHistory) - } - return "" -} - -func (m *editorCmp) stepBack(history []string) string { - m.promptHistoryIndex -= 1 - if m.promptHistoryIndex < 0 { - m.promptHistoryIndex = 0 - } - return history[m.promptHistoryIndex] -} - -func (m *editorCmp) stepForward(history []string) string { - m.promptHistoryIndex += 1 - maxIndex := len(history) - 1 - if m.promptHistoryIndex > maxIndex { - m.promptHistoryIndex = maxIndex - } - return history[m.promptHistoryIndex] -} - -func (m *editorCmp) resetHistory() { - m.historyCache = nil - m.promptHistoryIndex = 0 - m.previouslyScrollingPromptHistory = false -} -*/ - func (m *editorCmp) SetSize(width, height int) tea.Cmd { m.width = width m.height = height