Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions STATS.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# Download Stats

| Date | GitHub Downloads | npm Downloads | Total |
| ---------- | ---------------- | --------------- | ----------------- |
| 2025-06-29 | 18,789 (+0) | 39,420 (+0) | 58,209 (+0) |
| 2025-06-30 | 20,127 (+1,338) | 41,059 (+1,639) | 61,186 (+2,977) |
| 2025-07-01 | 22,108 (+1,981) | 43,745 (+2,686) | 65,853 (+4,667) |
| 2025-07-02 | 24,814 (+2,706) | 46,168 (+2,423) | 70,982 (+5,129) |
| 2025-07-03 | 27,834 (+3,020) | 49,955 (+3,787) | 77,789 (+6,807) |
| 2025-07-04 | 30,608 (+2,774) | 54,758 (+4,803) | 85,366 (+7,577) |
| 2025-07-05 | 32,524 (+1,916) | 58,371 (+3,613) | 90,895 (+5,529) |
| 2025-07-06 | 33,766 (+1,242) | 59,694 (+1,323) | 93,460 (+2,565) |
| 2025-07-08 | 38,052 (+4,286) | 64,468 (+4,774) | 102,520 (+9,060) |
| 2025-07-10 | 43,796 (+5,744) | 71,402 (+6,934) | 115,198 (+12,678) |
| 2025-07-11 | 46,982 (+3,186) | 77,462 (+6,060) | 124,444 (+9,246) |
| 2025-07-12 | 49,302 (+2,320) | 82,177 (+4,715) | 131,479 (+7,035) |
| 2025-07-13 | 50,803 (+1,501) | 86,394 (+4,217) | 137,197 (+5,718) |
| 2025-07-14 | 53,283 (+2,480) | 87,860 (+1,466) | 141,143 (+3,946) |
| 2025-07-15 | 57,590 (+4,307) | 91,036 (+3,176) | 148,626 (+7,483) |
| Date | GitHub Downloads | npm Downloads | Total |
| ---------- | ---------------- | ---------------- | ----------------- |
| 2025-06-29 | 18,789 (+0) | 39,420 (+0) | 58,209 (+0) |
| 2025-06-30 | 20,127 (+1,338) | 41,059 (+1,639) | 61,186 (+2,977) |
| 2025-07-01 | 22,108 (+1,981) | 43,745 (+2,686) | 65,853 (+4,667) |
| 2025-07-02 | 24,814 (+2,706) | 46,168 (+2,423) | 70,982 (+5,129) |
| 2025-07-03 | 27,834 (+3,020) | 49,955 (+3,787) | 77,789 (+6,807) |
| 2025-07-04 | 30,608 (+2,774) | 54,758 (+4,803) | 85,366 (+7,577) |
| 2025-07-05 | 32,524 (+1,916) | 58,371 (+3,613) | 90,895 (+5,529) |
| 2025-07-06 | 33,766 (+1,242) | 59,694 (+1,323) | 93,460 (+2,565) |
| 2025-07-08 | 38,052 (+4,286) | 64,468 (+4,774) | 102,520 (+9,060) |
| 2025-07-10 | 43,796 (+5,744) | 71,402 (+6,934) | 115,198 (+12,678) |
| 2025-07-11 | 46,982 (+3,186) | 77,462 (+6,060) | 124,444 (+9,246) |
| 2025-07-12 | 49,302 (+2,320) | 82,177 (+4,715) | 131,479 (+7,035) |
| 2025-07-13 | 50,803 (+1,501) | 86,394 (+4,217) | 137,197 (+5,718) |
| 2025-07-14 | 53,283 (+2,480) | 87,860 (+1,466) | 141,143 (+3,946) |
| 2025-07-15 | 57,590 (+4,307) | 91,036 (+3,176) | 148,626 (+7,483) |
| 2025-07-16 | 62,343 (+4,753) | 95,258 (+4,222) | 157,601 (+8,975) |
| 2025-07-17 | 66,382 (+4,039) | 100,048 (+4,790) | 166,430 (+8,829) |
| 2025-07-18 | 70,404 (+4,022) | 102,587 (+2,539) | 172,991 (+6,561) |
12 changes: 12 additions & 0 deletions packages/tui/internal/commands/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ const (
InputPasteCommand CommandName = "input_paste"
InputSubmitCommand CommandName = "input_submit"
InputNewlineCommand CommandName = "input_newline"
HistoryPreviousCommand CommandName = "history_previous"
HistoryNextCommand CommandName = "history_next"
MessagesPageUpCommand CommandName = "messages_page_up"
MessagesPageDownCommand CommandName = "messages_page_down"
MessagesHalfPageUpCommand CommandName = "messages_half_page_up"
Expand Down Expand Up @@ -264,6 +266,16 @@ func LoadFromConfig(config *opencode.Config) CommandRegistry {
Description: "insert newline",
Keybindings: parseBindings("shift+enter", "ctrl+j"),
},
{
Name: HistoryPreviousCommand,
Description: "previous input",
Keybindings: parseBindings("up"),
},
{
Name: HistoryNextCommand,
Description: "next input",
Keybindings: parseBindings("down"),
},
{
Name: MessagesPageUpCommand,
Description: "page up",
Expand Down
37 changes: 37 additions & 0 deletions packages/tui/internal/components/chat/editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ type EditorComponent interface {
Clear() (tea.Model, tea.Cmd)
Paste() (tea.Model, tea.Cmd)
Newline() (tea.Model, tea.Cmd)
HistoryPrevious() (tea.Model, tea.Cmd)
HistoryNext() (tea.Model, tea.Cmd)
SetValue(value string)
SetInterruptKeyInDebounce(inDebounce bool)
SetExitKeyInDebounce(inDebounce bool)
Expand All @@ -50,6 +52,8 @@ type editorComponent struct {
spinner spinner.Model
interruptKeyInDebounce bool
exitKeyInDebounce bool
history []string
historyIndex int
}

func (m *editorComponent) Init() tea.Cmd {
Expand Down Expand Up @@ -357,6 +361,9 @@ func (m *editorComponent) Submit() (tea.Model, tea.Cmd) {
})
}

m.history = append(m.history, value)
m.historyIndex = len(m.history)

updated, cmd := m.Clear()
m = updated.(*editorComponent)
cmds = append(cmds, cmd)
Expand Down Expand Up @@ -403,6 +410,34 @@ func (m *editorComponent) Newline() (tea.Model, tea.Cmd) {
return m, nil
}

func (m *editorComponent) HistoryPrevious() (tea.Model, tea.Cmd) {
if len(m.history) == 0 {
return m, nil
}
if m.historyIndex > 0 {
m.historyIndex--
}
m.SetValue(m.history[m.historyIndex])
m.textarea.CursorEnd()
return m, nil
}

func (m *editorComponent) HistoryNext() (tea.Model, tea.Cmd) {
if len(m.history) == 0 {
m.SetValue("")
return m, nil
}
if m.historyIndex < len(m.history)-1 {
m.historyIndex++
m.SetValue(m.history[m.historyIndex])
} else {
m.historyIndex = len(m.history)
m.SetValue("")
}
m.textarea.CursorEnd()
return m, nil
}

func (m *editorComponent) SetInterruptKeyInDebounce(inDebounce bool) {
m.interruptKeyInDebounce = inDebounce
}
Expand Down Expand Up @@ -487,6 +522,8 @@ func NewEditorComponent(app *app.App) EditorComponent {
textarea: ta,
spinner: s,
interruptKeyInDebounce: false,
history: []string{},
historyIndex: 0,
}

return m
Expand Down
8 changes: 8 additions & 0 deletions packages/tui/internal/tui/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,14 @@ func (a appModel) executeCommand(command commands.Command) (tea.Model, tea.Cmd)
updated, cmd := a.editor.Newline()
a.editor = updated.(chat.EditorComponent)
cmds = append(cmds, cmd)
case commands.HistoryPreviousCommand:
updated, cmd := a.editor.HistoryPrevious()
a.editor = updated.(chat.EditorComponent)
cmds = append(cmds, cmd)
case commands.HistoryNextCommand:
updated, cmd := a.editor.HistoryNext()
a.editor = updated.(chat.EditorComponent)
cmds = append(cmds, cmd)
case commands.MessagesFirstCommand:
updated, cmd := a.messages.First()
a.messages = updated.(chat.MessagesComponent)
Expand Down
6 changes: 6 additions & 0 deletions packages/tui/sdk/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,10 @@ type Keybinds struct {
InputPaste string `json:"input_paste,required"`
// Submit input
InputSubmit string `json:"input_submit,required"`
// Previous input history
HistoryPrevious string `json:"history_previous,required"`
// Next input history
HistoryNext string `json:"history_next,required"`
// Leader key for keybind combinations
Leader string `json:"leader,required"`
// Copy message
Expand Down Expand Up @@ -580,6 +584,8 @@ type keybindsJSON struct {
InputNewline apijson.Field
InputPaste apijson.Field
InputSubmit apijson.Field
HistoryPrevious apijson.Field
HistoryNext apijson.Field
Leader apijson.Field
MessagesCopy apijson.Field
MessagesFirst apijson.Field
Expand Down