Skip to content

Commit

Permalink
F
Browse files Browse the repository at this point in the history
  • Loading branch information
adambabik committed Jan 5, 2023
1 parent 42bdb5d commit 405aafa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/kernel/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ func detectPrompt(cmdName string) ([]byte, error) {
break
}
}
return prompt, nil
return dropANSIEscape(prompt), nil
}
1 change: 1 addition & 0 deletions internal/kernel/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func (m *kernelServiceServer) PostSession(ctx context.Context, req *kernelv1.Pos
if len(prompt) == 0 {
var err error
prompt, err = DetectPrompt(req.CommandName)
m.logger.Info("detected prompt", zap.Error(err), zap.ByteString("prompt", prompt))
if err != nil {
return nil, fmt.Errorf("failed to detect prompt: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/kernel/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func scanLinesPrompt(data []byte, atEOF bool, prompt []byte) (advance int, token
newLineIdx := bytes.IndexByte(data, '\n')
if promptIdx >= 0 && (newLineIdx < 0 || promptIdx < newLineIdx) {
m := promptIdx + len(prompt)
if len(data) >= m && data[m] == ' ' {
if len(data) > m && data[m] == ' ' {
m++
}
return m, data[0 : promptIdx+len(prompt)], nil
Expand Down

0 comments on commit 405aafa

Please sign in to comment.