Pārlūkot izejas kodu

Make move to start of line with 0 parameter work - Fixes #40

Nick Craig-Wood 6 gadi atpakaļ
vecāks
revīzija
e7796444f8
1 mainītis faili ar 3 papildinājumiem un 0 dzēšanām
  1. 3 0
      colorable_windows.go

+ 3 - 0
colorable_windows.go

@@ -557,6 +557,9 @@ loop:
 			if err != nil {
 				continue
 			}
+			if n < 1 {
+				n = 1
+			}
 			procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
 			csbi.cursorPosition.x = short(n - 1)
 			procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))