term.go 710 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2012 Jonas mg
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this
  5. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6. package term
  7. // If it is true, at reading a password it shows characters shadowed by each key
  8. // pressed.
  9. var PasswordShadowed bool
  10. var (
  11. _CTRL_C = []byte{'^', 'C', '\r', '\n'}
  12. _RETURN = []byte{'\r', '\n'}
  13. _SHADOW_CHAR = []byte{'*'}
  14. )
  15. // * * *
  16. type modeType int
  17. const (
  18. _ modeType = 1 << iota
  19. RawMode
  20. EchoMode
  21. CharMode
  22. PasswordMode
  23. OtherMode
  24. )
  25. // Mode returns the mode set in the terminal, if any.
  26. func (t *Terminal) Mode() modeType {
  27. return t.mode
  28. }