File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ func removeMessageBox(msg string) string {
5555func removeCodexMessageBox (msg string ) string {
5656 lines := strings .Split (msg , "\n " )
5757 messageBoxEndIdx := - 1
58- messageBoxStartIdx := 0
58+ messageBoxStartIdx := - 1
59+
5960 for i := len (lines ) - 1 ; i >= 0 ; i -- {
6061 if messageBoxEndIdx == - 1 {
6162 if strings .Contains (lines [i ], "╰────────" ) && strings .Contains (lines [i ], "───────╯" ) {
@@ -80,9 +81,16 @@ func removeCodexMessageBox(msg string) string {
8081 }
8182 }
8283
83- if messageBoxEndIdx > messageBoxStartIdx {
84- return strings .Join (lines [messageBoxStartIdx :messageBoxEndIdx ], "\n " )
84+ // If we didn't find messageBoxStartIdx, set it to 0
85+ if messageBoxStartIdx == - 1 {
86+ messageBoxStartIdx = 0
8587 }
8688
87- return strings .Join (lines , "\n " )
89+ // If we didn't find messageBoxEndIdx, set it to the end of the lines
90+ if messageBoxEndIdx == - 1 {
91+ messageBoxEndIdx = len (lines ) - 1
92+ }
93+
94+ return strings .Join (lines [messageBoxStartIdx :messageBoxEndIdx ], "\n " )
95+
8896}
You can’t perform that action at this time.
0 commit comments