This commit is contained in:
Kovid Goyal
2024-10-19 10:51:18 +05:30
parent ee4b89055f
commit b66d9332f9

View File

@@ -1014,6 +1014,7 @@ class TestScreen(BaseTest):
def ac(idx, count):
self.ae(c.wtcbuf, f'\033[{idx};{count}#Q'.encode('ascii'))
c.clear()
# ]]]]]]]]]]]]]]]]}}}}}}}}}}}}}}}}))))))))))))))))))))))
w('#R')
ac(0, 0)
@@ -1055,18 +1056,18 @@ class TestScreen(BaseTest):
t('http://moo.com', before=st, after=e)
for trailer in ')-=':
t('http://moo.com' + trailer)
for trailer in '{}([<>':
for trailer in '{}([<>': # )]>
t('http://moo.com', after=trailer)
t('http://moo.com', x=s.columns - 9)
t('https://wraps-by-one-char.com', before='[', after=']')
t('http://[::1]:8080')
t('https://wr[aps-by-one-ch]ar.com')
t('http://[::1]:8080/x', after='[')
t('http://[::1]:8080/x', after='[') # ]
t('http://[::1]:8080/x]y34', expected='http://[::1]:8080/x')
t('https://wraps-by-one-char.com[]/x', after='[')
t('https://wraps-by-one-char.com[]/x', after='[') # ]
def test_prompt_marking(self):
s = self.create_screen()
# ]]]]]]]]]]]]]]]]}}}}}}}}}}}}}}}}))))))))))))))))))))))
def mark_prompt():
parse_bytes(s, b'\033]133;A\007')
@@ -1074,6 +1075,21 @@ class TestScreen(BaseTest):
def mark_output():
parse_bytes(s, b'\033]133;C\007')
def draw_prompt(x):
mark_prompt(), s.draw(f'$ {x}'), s.carriage_return(), s.index()
def draw_output(n, x='', m=True):
if m:
mark_output()
for i in range(n):
s.draw(f'{i}{x}'), s.index(), s.carriage_return()
def lines_with_attrs():
b = []
s.dump_lines_with_attrs(b.append)
return ''.join(b)
s = self.create_screen()
for i in range(4):
mark_prompt()
s.draw(f'$ {i}')
@@ -1133,16 +1149,7 @@ class TestScreen(BaseTest):
mark_prompt(), s.draw('$ 1')
self.ae(fco(), 'abcd\n12')
self.ae(lco(), 'abcd\n12')
self.ae(lco(as_ansi=True), '\x1b[m\x1b]133;C\x1b\\abcd\n\x1b[m12')
def draw_prompt(x):
mark_prompt(), s.draw(f'$ {x}'), s.carriage_return(), s.index()
def draw_output(n, x='', m=True):
if m:
mark_output()
for i in range(n):
s.draw(f'{i}{x}'), s.index(), s.carriage_return()
self.ae(lco(as_ansi=True), '\x1b[m\x1b]133;C\x1b\\abcd\n\x1b[m12') # ]]]
s = self.create_screen(cols=5, lines=5, scrollback=15)
draw_output(1, 'start', False)