You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
554 B

  1. // +build windows
  2. package readline
  3. import (
  4. "io"
  5. "syscall"
  6. )
  7. func SuspendMe() {
  8. }
  9. func GetStdin() int {
  10. return int(syscall.Stdin)
  11. }
  12. func init() {
  13. isWindows = true
  14. }
  15. // get width of the terminal
  16. func GetScreenWidth() int {
  17. info, _ := GetConsoleScreenBufferInfo()
  18. if info == nil {
  19. return -1
  20. }
  21. return int(info.dwSize.x)
  22. }
  23. // ClearScreen clears the console screen
  24. func ClearScreen(_ io.Writer) error {
  25. return SetConsoleCursorPosition(&_COORD{0, 0})
  26. }
  27. func DefaultIsTerminal() bool {
  28. return true
  29. }
  30. func DefaultOnWidthChanged(func()) {
  31. }