enums.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # -*- coding: utf-8 -*-
  2. """General constants used to spawn a PTY."""
  3. class Backend:
  4. """Available PTY backends."""
  5. ConPTY = 0
  6. WinPTY = 1
  7. class Encoding:
  8. """Available byte encodings to communicate with a PTY."""
  9. UTF8 = 'utf-8'
  10. UTF16 = 'utf-16'
  11. class MouseMode:
  12. """Mouse capture settings for the winpty backend."""
  13. # QuickEdit mode is initially disabled, and the agent does not send mouse
  14. # mode sequences to the terminal. If it receives mouse input, though, it
  15. # still writes MOUSE_EVENT_RECORD values into CONIN.
  16. WINPTY_MOUSE_MODE_NONE = 0
  17. # QuickEdit mode is initially enabled. As CONIN enters or leaves mouse
  18. # input mode (i.e. where ENABLE_MOUSE_INPUT is on and
  19. # ENABLE_QUICK_EDIT_MODE is off), the agent enables or disables mouse
  20. # input on the terminal.
  21. WINPTY_MOUSE_MODE_AUTO = 1
  22. # QuickEdit mode is initially disabled, and the agent enables the
  23. # terminal's mouse input mode. It does not disable terminal
  24. # mouse mode (until exit).
  25. WINPTY_MOUSE_MODE_FORCE = 2
  26. class AgentConfig:
  27. """General configuration settings for the winpty backend."""
  28. # Create a new screen buffer (connected to the "conerr" terminal pipe) and
  29. # pass it to child processes as the STDERR handle. This flag also prevents
  30. # the agent from reopening CONOUT$ when it polls -- regardless of whether
  31. # the active screen buffer changes, winpty continues to monitor the
  32. # original primary screen buffer.
  33. WINPTY_FLAG_CONERR = 0x1
  34. # Don't output escape sequences.
  35. WINPTY_FLAG_PLAIN_OUTPUT = 0x2
  36. # Do output color escape sequences. These escapes are output by default,
  37. # but are suppressed with WINPTY_FLAG_PLAIN_OUTPUT.
  38. # Use this flag to re-enable them.
  39. WINPTY_FLAG_COLOR_ESCAPES = 0x4