Merge branch 'add-X-sequence'
Alec The Rabbit
4 years ago
11 | 11 | "strings" |
12 | 12 | "syscall" |
13 | 13 | "unsafe" |
14 | ||
15 | "github.com/mattn/go-isatty" | |
16 | 14 | ) |
17 | 15 | |
18 | 16 | const ( |
634 | 632 | } |
635 | 633 | procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) |
636 | 634 | procFillConsoleOutputAttribute.Call(uintptr(handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) |
635 | case 'X': | |
636 | n := 0 | |
637 | if buf.Len() > 0 { | |
638 | n, err = strconv.Atoi(buf.String()) | |
639 | if err != nil { | |
640 | continue | |
641 | } | |
642 | } | |
643 | procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) | |
644 | var cursor coord | |
645 | var count, written dword | |
646 | cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y} | |
647 | // switch n { | |
648 | // case 0: | |
649 | // count = dword(csbi.size.x - csbi.cursorPosition.x) | |
650 | // case 1: | |
651 | // cursor = coord{x: csbi.window.left, y: csbi.cursorPosition.y} | |
652 | // count = dword(csbi.size.x - csbi.cursorPosition.x) | |
653 | // case 2: | |
654 | // cursor = coord{x: csbi.window.left, y: csbi.cursorPosition.y} | |
655 | // count = dword(csbi.size.x) | |
656 | // } | |
657 | procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(n), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) | |
658 | procFillConsoleOutputAttribute.Call(uintptr(handle), uintptr(csbi.attributes), uintptr(n), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) | |
637 | 659 | case 'm': |
638 | 660 | procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) |
639 | 661 | attr := csbi.attributes |