Browse Source

Merge pull request #42 from ncw/fix-40

Make move to start of line with 0 parameter work - Fixes #40
mattn 6 years ago
parent
commit
b568324456
1 changed files with 3 additions and 0 deletions
  1. 3 0
      colorable_windows.go

+ 3 - 0
colorable_windows.go

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