Skip to content

Commit

Permalink
Fix negative index
Browse files Browse the repository at this point in the history
  • Loading branch information
Naatan committed Sep 12, 2023
1 parent 6c6570d commit ba23340
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion helpers_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func cleanPtySnapshot(snapshot []byte, cursorPos int, isPosix bool) ([]byte, int

newCursorPos := cursorPos
dropPos := func(pos int) {
if pos <= cursorPos {
if pos < cursorPos {
newCursorPos--
}
}
Expand Down
7 changes: 7 additions & 0 deletions helpers_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ func Test_cleanPtySequences(t *testing.T) {
[]byte("25h 25l █ Installing Runtime (Unconfigured)25h 25l █25h 25l █ Installing Runtime Environment25h 25l Setting Up Runtime \n Resolving Dependencies |25h"),
159,
},
{
"Escape at first character",
[]byte("\u001B[1mfoo"),
0,
[]byte("foo"),
0,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit ba23340

Please sign in to comment.