-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathgateone_terminal_emulator.py
60 lines (43 loc) · 1.45 KB
/
gateone_terminal_emulator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from . import GateOne
class GateOneTerminalEmulator():
def __init__(self, cols, lines, hist, ratio):
self._term = GateOne.Terminal(rows=lines, cols=cols)
self._modified = True
def feed(self, data):
self._term.write(data)
self._modified = True
def resize(self, lines, cols):
self._term.resize(rows=lines, cols=cols)
self._modified = True
def prev_page(self):
self._term.scroll_up()
def next_page(self):
self._term.scroll_down()
def dirty_lines(self):
if not self._modified:
return {}
i = 0
dirty_lines = {}
for line in self._term.dump():
dirty_lines[i] = line
i = i + 1
# convert_go_renditions_to_colormap(self._term.renditions, self._term.renditions_store, [])
return dirty_lines
def clear_dirty(self):
self._modified = False
def cursor(self):
return self._term.cursorY, self._term.cursorX
def color_map(self, lines):
return {}
def display(self):
return self._term.dump()
def modified(self):
return self._modified
def bracketed_paste_mode_enabled(self):
# TODO Gateone doesnt seem to record this. But it supports callback for
# custom escape sequences ?
return False
def application_mode_enabled(self):
return self._term.expanded_modes['1']
def nb_lines(self):
return self._term.rows