Store pager history in UTF-8

Reduces storage requirement by a fator of 4 at the cost of some CPU
usage, to encode to UTF-8
This commit is contained in:
Kovid Goyal
2020-09-21 12:29:10 +05:30
parent bf19d2b156
commit b5007ba276
4 changed files with 52 additions and 27 deletions

View File

@@ -468,7 +468,7 @@ class TestScreen(BaseTest):
self.ae(as_text(s, True, True), '\x1b[m\x1b[31m11\x1b[m\x1b[32m22\x1b[m\x1b[33m33\x1b[m\x1b[34m44\x1b[m\x1b[m\x1b[35m55\x1b[m\x1b[36m66')
def test_pagerhist(self):
hsz = 32
hsz = 8
s = self.create_screen(cols=2, lines=2, scrollback=2, options={'scrollback_pager_history_size': hsz})
def contents():
@@ -479,7 +479,7 @@ class TestScreen(BaseTest):
def test():
expected = ''.join(q)
maxlen = hsz // 4
maxlen = hsz
extra = len(expected) - maxlen
if extra > 0:
expected = expected[extra:]
@@ -489,11 +489,13 @@ class TestScreen(BaseTest):
q = []
for i in range(4):
s.draw(f'{i}' * s.columns)
self.ae(contents(), '\n')
self.ae(contents(), '')
s.draw('4' * s.columns), line(0), test()
s.draw('5' * s.columns), line(1), test()
s.draw('6' * s.columns), line(2), test()
s.draw('7' * s.columns), line(3), test()
s.draw('8' * s.columns), line(4), test()
s.draw('9' * s.columns), line(5), test()
def test_user_marking(self):