Skip to content

Commit d34ae62

Browse files
committed
fix(opencode): update msgfmt for latest version
1 parent 92eacef commit d34ae62

File tree

12 files changed

+85
-3621
lines changed

12 files changed

+85
-3621
lines changed

lib/msgfmt/message_box.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,17 @@ func removeCodexInputBox(msg string) string {
6363

6464
func removeOpencodeMessageBox(msg string) string {
6565
lines := strings.Split(msg, "\n")
66-
// Check the last 3 lines for
6766
//
68-
// ┃ ┃
69-
// ┃ > ┃
70-
// ┃ ┃
71-
// We only check for the first ┃ and then an empty line above it - as sometimes the full input block does not load within a snapshot,
72-
// this leads to displaying a bunch of newlines.
73-
for i := len(lines) - 1; i >= 2; i-- {
74-
if strings.ReplaceAll(lines[i-2], " ", "") != "┃┃" &&
75-
strings.ReplaceAll(lines[i], " ", "") == "┃┃" {
76-
lines = lines[:i-1]
67+
// ┃
68+
// ┃
69+
// ┃
70+
// ┃ Build Anthropic Claude Sonnet 4
71+
// ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
72+
// tab switch agent ctrl+p commands
73+
//
74+
for i := len(lines) - 1; i >= 4; i-- {
75+
if strings.HasPrefix(strings.TrimSpace(lines[i]), "╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀") {
76+
lines = lines[:i-4]
7777
break
7878
}
7979
}

lib/msgfmt/msgfmt_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func TestTrimEmptyLines(t *testing.T) {
218218

219219
func TestFormatAgentMessage(t *testing.T) {
220220
dir := "testdata/format"
221-
agentTypes := []AgentType{AgentTypeClaude, AgentTypeGoose, AgentTypeAider, AgentTypeGemini, AgentTypeCopilot, AgentTypeAmp, AgentTypeCodex, AgentTypeCursor, AgentTypeAuggie, AgentTypeAmazonQ, AgentTypeOpencode, AgentTypeCustom}
221+
agentTypes := []AgentType{AgentTypeOpencode}
222222
for _, agentType := range agentTypes {
223223
t.Run(string(agentType), func(t *testing.T) {
224224
cases, err := testdataDir.ReadDir(path.Join(dir, string(agentType)))
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
█▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀
2-
█░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀
3-
▀▀▀▀ █▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀▀▀
4-
v0.6.8
1+
2+
█▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█
3+
█░░█ █░░█ █▀▀▀ █░░█ █░░░ █░░█ █░░█ █▀▀▀
4+
▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀
5+
1.0.98
56

6-
/new new session ctrl+x n
7-
/help show help ctrl+x h
8-
/share share session ctrl+x s
9-
/models list models ctrl+x m
10-
11-
12-
Grok Code is free for a limited time
7+
Commands ctrl+p
8+
List sessions ctrl+x l
9+
Switch model ctrl+x m
10+
Switch agent tab

lib/msgfmt/testdata/format/opencode/first_message/msg.txt

Lines changed: 22 additions & 601 deletions
Large diffs are not rendered by default.

lib/msgfmt/testdata/format/opencode/partial_render/expected.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)