Change summary
internal/tui/components/chat/editor/editor.go | 68 ---------------------
1 file changed, 68 deletions(-)
Detailed changes
@@ -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