Skip to content

Commit 4ddc273

Browse files
committed
Adjust default tabstops
See #51 for details
1 parent bbc2e05 commit 4ddc273

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pyte_terminal_emulator.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def feed(self, data):
2525
self._screen.scroll_to_bottom()
2626
self._bytestream.feed(data)
2727
self._modified = True
28+
print(self._screen.tabstops)
2829

2930
def resize(self, lines, cols):
3031
self._screen.scroll_to_bottom()
@@ -104,6 +105,15 @@ def __init__(self, columns, lines, history, ratio):
104105

105106
super(CustomHistoryScreen, self).__init__(columns, lines)
106107

108+
# We do not agree with pyte about default tabstops
109+
self.tabstops = set(range(8, self.columns, 8))
110+
111+
def reset(self):
112+
super(CustomHistoryScreen, self).reset()
113+
114+
# Reset tab stops
115+
self.tabstops = set(range(8, self.columns, 8))
116+
107117
def scroll_to_bottom(self):
108118
"""
109119
Ensure a screen is at the bottom of the history buffer
@@ -255,6 +265,9 @@ def resize(self, lines=None, columns=None):
255265
# JW tweak - move cursor upwards if its out of bounds do not reset it
256266
self.ensure_bounds(use_margins=True)
257267

268+
# Update tabstops to new screen size
269+
self.tabstops = set(range(8, self.columns, 8))
270+
258271

259272
def take(n, iterable):
260273
"""Returns first n items of the iterable as a list."""

0 commit comments

Comments
 (0)