Skip to content

Commit 2d90f9b

Browse files
committed
feat(copilot): update message formatting and improve message box detection logic
1 parent c8502fb commit 2d90f9b

File tree

5 files changed

+19
-15
lines changed

5 files changed

+19
-15
lines changed

lib/msgfmt/message_box.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ func findGreaterThanMessageBox(lines []string) int {
2828
func findGenericSlimMessageBox(lines []string) int {
2929
for i := len(lines) - 3; i >= max(len(lines)-9, 0); i-- {
3030
if strings.Contains(lines[i], "───────────────") &&
31-
(strings.Contains(lines[i+1], "|") || strings.Contains(lines[i+1], "│") || strings.Contains(lines[i+1], "❯")) &&
32-
strings.Contains(lines[i+2], "───────────────") {
33-
return i
31+
(strings.Contains(lines[i+1], "|") || strings.Contains(lines[i+1], "│") || strings.Contains(lines[i+1], "❯")) {
32+
if (i+2 < len(lines) && strings.Contains(lines[i+2], "───────────────")) ||
33+
(i+3 < len(lines) && strings.Contains(lines[i+3], "───────────────")) {
34+
return i
35+
}
3436
}
3537
}
3638
return -1

lib/msgfmt/testdata/format/copilot/first_message/expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
● Connected to GitHub MCP Server
1010

11-
~/Documents/work/agentapi [⎇ feat-github-cli*]
11+
~/Documents/work/.../agentapi [⎇ main*] claude-haiku-4.5 (1x)

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
● Connected to GitHub MCP Server
1010

11-
~/Documents/work/agentapi [⎇ feat-github-cli*]
12-
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
13-
│ > Enter @ to mention files or / for commands │
14-
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
15-
Ctrl+c Exit · Ctrl+r Expand all
11+
~/Documents/work/.../agentapi [⎇ main*] claude-haiku-4.5 (1x)
12+
───────────────────────────────────────────────────────────────────
13+
❯ Type @ to mention files, # for issues/PRs, / for commands, or ?
14+
for shortcuts
15+
───────────────────────────────────────────────────────────────────
16+
shift+tab switch mode

lib/msgfmt/testdata/format/copilot/thinking/expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
◉ Thinking (Esc to cancel)
88

9-
~/Documents/work/agentapi [⎇ feat-github-cli*]
9+
~/Documents/work/.../agentapi [⎇ main*] claude-haiku-4.5 (1x)

lib/msgfmt/testdata/format/copilot/thinking/msg.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828

2929
◉ Thinking (Esc to cancel)
3030

31-
~/Documents/work/agentapi [⎇ feat-github-cli*]
32-
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
33-
│ > Enter @ to mention files or / for commands │
34-
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
35-
Ctrl+c Exit · Ctrl+r Expand all Remaining requests: 0%
31+
~/Documents/work/.../agentapi [⎇ main*] claude-haiku-4.5 (1x)
32+
───────────────────────────────────────────────────────────────────
33+
❯ Type @ to mention files, # for issues/PRs, / for commands, or ?
34+
for shortcuts
35+
───────────────────────────────────────────────────────────────────
36+
shift+tab switch mode Remaining requests: 0%

0 commit comments

Comments
 (0)