Skip to content

Commit 8fc86c6

Browse files
committed
chore: rename variables
1 parent dbbc9ca commit 8fc86c6

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

lib/termexec/termexec.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ import (
1919
)
2020

2121
type Process struct {
22-
xp *xpty.Xpty
23-
execCmd *exec.Cmd
24-
screenUpdateLock sync.RWMutex
25-
lastScreenUpdate time.Time
26-
checkDynamicHeader bool
27-
agentType msgfmt.AgentType
22+
xp *xpty.Xpty
23+
execCmd *exec.Cmd
24+
screenUpdateLock sync.RWMutex
25+
lastScreenUpdate time.Time
26+
checkAnimatedContent bool
27+
agentType msgfmt.AgentType
2828
}
2929

3030
type StartProcessConfig struct {
@@ -50,7 +50,7 @@ func StartProcess(ctx context.Context, args StartProcessConfig) (*Process, error
5050
return nil, err
5151
}
5252

53-
process := &Process{xp: xp, execCmd: execCmd, checkDynamicHeader: true, agentType: args.AgentType}
53+
process := &Process{xp: xp, execCmd: execCmd, checkAnimatedContent: true, agentType: args.AgentType}
5454

5555
go func() {
5656
// HACK: Working around xpty concurrency limitations
@@ -122,16 +122,16 @@ func (p *Process) ReadScreen() string {
122122
if time.Since(p.lastScreenUpdate) >= 16*time.Millisecond {
123123
state = p.xp.State.String()
124124
p.screenUpdateLock.RUnlock()
125-
if p.checkDynamicHeader {
126-
state, p.checkDynamicHeader = removeDynamicHeader(state, p.agentType)
125+
if p.checkAnimatedContent {
126+
state, p.checkAnimatedContent = removeAnimatedContent(state, p.agentType)
127127
}
128128
return state
129129
}
130130
p.screenUpdateLock.RUnlock()
131131
time.Sleep(16 * time.Millisecond)
132132
}
133-
if p.checkDynamicHeader {
134-
state, p.checkDynamicHeader = removeDynamicHeader(p.xp.State.String(), p.agentType)
133+
if p.checkAnimatedContent {
134+
state, p.checkAnimatedContent = removeAnimatedContent(p.xp.State.String(), p.agentType)
135135
}
136136
return state
137137
}

lib/termexec/utils.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"github.com/coder/agentapi/lib/msgfmt"
77
)
88

9-
func calcAmpDynamicHeader(lines []string) (int, bool) {
10-
dynamicHeaderEnd := -1
9+
func calcAmpAnimatedContent(lines []string) (int, bool) {
10+
animatedContentEnd := -1
1111
firstTextEncountered := false
1212
continueRemoving := true
1313

@@ -22,16 +22,16 @@ func calcAmpDynamicHeader(lines []string) (int, bool) {
2222
}
2323
if firstTextEncountered && len(strings.Trim(lines[i], " \n")) == 0 && len(strings.Trim(lines[i+1], " \n")) == 0 &&
2424
len(strings.Trim(lines[i+2], " \n")) == 0 {
25-
dynamicHeaderEnd = i
25+
animatedContentEnd = i
2626
break
2727

2828
}
2929
}
3030
}
31-
return dynamicHeaderEnd, continueRemoving
31+
return animatedContentEnd, continueRemoving
3232
}
3333

34-
func calcOpencodeDynamicHeader(lines []string) (int, bool) {
34+
func calcOpencodeAnimatedContent(lines []string) (int, bool) {
3535
// Skip header lines for Opencode agent type to avoid false positives
3636
// The header contains dynamic content (token count, context percentage, cost)
3737
// that changes between screens, causing line comparison mismatches:
@@ -44,16 +44,16 @@ func calcOpencodeDynamicHeader(lines []string) (int, bool) {
4444
return -1, true
4545
}
4646

47-
func removeDynamicHeader(screen string, agentType msgfmt.AgentType) (string, bool) {
47+
func removeAnimatedContent(screen string, agentType msgfmt.AgentType) (string, bool) {
4848
lines := strings.Split(screen, "\n")
49-
dynamicHeaderEnd := -1
49+
animatedContentEnd := -1
5050
var continueRemoving bool
5151
if agentType == msgfmt.AgentTypeAmp {
52-
dynamicHeaderEnd, continueRemoving = calcAmpDynamicHeader(lines)
52+
animatedContentEnd, continueRemoving = calcAmpAnimatedContent(lines)
5353
} else if agentType == msgfmt.AgentTypeOpencode {
54-
dynamicHeaderEnd, continueRemoving = calcOpencodeDynamicHeader(lines)
54+
animatedContentEnd, continueRemoving = calcOpencodeAnimatedContent(lines)
5555
} else {
5656
continueRemoving = false
5757
}
58-
return strings.Join(lines[dynamicHeaderEnd+1:], "\n"), continueRemoving
58+
return strings.Join(lines[animatedContentEnd+1:], "\n"), continueRemoving
5959
}

0 commit comments

Comments
 (0)