Skip to content

Commit

Permalink
Also test changing of title when running command
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Feb 21, 2022
1 parent 2610573 commit da5e376
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions kitty_tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def write(self, data) -> None:
self.wtcbuf += data

def title_changed(self, data) -> None:
self.titlebuf += data
self.titlebuf.append(data)

def icon_changed(self, data) -> None:
self.iconbuf += data
Expand Down Expand Up @@ -61,7 +61,8 @@ def clipboard_control(self, data: str, is_partial: bool = False) -> None:

def clear(self) -> None:
self.wtcbuf = b''
self.iconbuf = self.titlebuf = self.colorbuf = self.ctbuf = ''
self.iconbuf = self.colorbuf = self.ctbuf = ''
self.titlebuf = []
self.iutf8 = True
self.notifications = []
self.open_urls = []
Expand Down
10 changes: 5 additions & 5 deletions kitty_tests/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,18 @@ def test_osc_codes(self):
c = s.callbacks
pb('a\033]2;x\\ryz\x9cbcde', 'a', ('set_title', 'x\\ryz'), 'bcde')
self.ae(str(s.line(0)), 'abcde')
self.ae(c.titlebuf, 'x\\ryz')
self.ae(c.titlebuf, ['x\\ryz'])
c.clear()
pb('\033]\x07', ('set_title', ''), ('set_icon', ''))
self.ae(c.titlebuf, ''), self.ae(c.iconbuf, '')
self.ae(c.titlebuf, ['']), self.ae(c.iconbuf, '')
pb('\033]ab\x07', ('set_title', 'ab'), ('set_icon', 'ab'))
self.ae(c.titlebuf, 'ab'), self.ae(c.iconbuf, 'ab')
self.ae(c.titlebuf, ['', 'ab']), self.ae(c.iconbuf, 'ab')
c.clear()
pb('\033]2;;;;\x07', ('set_title', ';;;'))
self.ae(c.titlebuf, ';;;')
self.ae(c.titlebuf, [';;;'])
c.clear()
pb('\033]2;\x07', ('set_title', ''))
self.ae(c.titlebuf, '')
self.ae(c.titlebuf, [''])
pb('\033]110\x07', ('set_dynamic_color', 110, ''))
self.ae(c.colorbuf, '')
c.clear()
Expand Down
4 changes: 3 additions & 1 deletion kitty_tests/shell_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ def test_zsh_integration(self):
except TimeoutError:
raise AssertionError(f'Cursor was not changed to beam. Screen contents: {repr(pty.screen_contents())}')
self.ae(pty.screen_contents(), q)
self.ae(pty.callbacks.titlebuf, '~')
self.ae(pty.callbacks.titlebuf, ['~'])
pty.callbacks.clear()
pty.send_cmd_to_child('mkdir test && ls -a')
pty.wait_till(lambda: pty.screen_contents().count(ps1) == 2)
self.ae(pty.callbacks.titlebuf, ['mkdir test && ls -a', '~'])
q = '\n'.join(str(pty.screen.line(i)) for i in range(1, pty.screen.cursor.y))
self.ae(pty.last_cmd_output(), q)

0 comments on commit da5e376

Please sign in to comment.