Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robinovitch61 committed Dec 24, 2024
1 parent e9ff1d8 commit a3c4c8d
Show file tree
Hide file tree
Showing 2 changed files with 169 additions and 134 deletions.
4 changes: 2 additions & 2 deletions internal/linebuffer/linebuffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (l LineBuffer) Truncate(xOffset, width int) string {
return visible
}

func reapplyANSI(original, truncated string, truncOffset int, ansiCodeIndexes [][]int) string {
func reapplyANSI(original, truncated string, truncByteOffset int, ansiCodeIndexes [][]int) string {
var result []byte
var lenAnsiAdded int
isReset := true
Expand All @@ -129,7 +129,7 @@ func reapplyANSI(original, truncated string, truncOffset int, ansiCodeIndexes []
for len(ansiCodeIndexes) > 0 {
candidateAnsi := ansiCodeIndexes[0]
codeStart, codeEnd := candidateAnsi[0], candidateAnsi[1]
originalIdx := truncOffset + i + lenAnsiAdded
originalIdx := truncByteOffset + i + lenAnsiAdded
if codeStart <= originalIdx {
code := original[codeStart:codeEnd]
isReset = code == "\x1b[m"
Expand Down
Loading

0 comments on commit a3c4c8d

Please sign in to comment.