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