Hello community, here is the log from the commit of package python-pyte for openSUSE:Factory checked in at 2018-07-09 13:30:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pyte (Old) and /work/SRC/openSUSE:Factory/.python-pyte.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pyte" Mon Jul 9 13:30:20 2018 rev:5 rq:621579 version:0.8.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pyte/python-pyte.changes 2017-11-10 14:56:55.185114772 +0100 +++ /work/SRC/openSUSE:Factory/.python-pyte.new/python-pyte.changes 2018-07-09 13:31:34.982461349 +0200 @@ -1,0 +2,31 @@ +Sun Jul 8 16:42:49 UTC 2018 - [email protected] + +- Enable tests unconditionaly + +------------------------------------------------------------------- +Sat Jul 7 17:08:25 UTC 2018 - [email protected] + +- specfile: + * update copyright year + +- update to version 0.8.0: + * Modified the logic around tracking position in the + "HistoryScreen", allowing the full history to be accessed. See PR + #96 on GitHub. + * Send C0 encoded CSI instead of C1, avoiding compatibility issues + with unicode. See issue #99 on GitHub. + * Changed "Stream" to really ignore "SI" in UTF-8 mode. See PR #106 + on GitHub. Thanks to @jwodder! + * Fixed `DECSCNM` handling bug. The attributes of + "Screen.default_char" were not reversed leaving all blank + characters as-is. See PR #102 on GitHub. Thanks to @zblz! + * Correctly terminate OSC mode in "Stream" on receipt of a C0 + encoded "ST" character. + * Allowed resetting cursor attributes in the middle of the SGR + sequence. See PR#109 on GiHub. Thanks @andreivasiliu! + * On exit from `DECCOLM` mode, restore the terminal width from + before entering `DECCOLM` mode. + * Changed "Screen.select_graphic_rendition" to ignore + malformed256/24bit colours. See issue #115 on GitHub. + +------------------------------------------------------------------- Old: ---- pyte-0.7.0.tar.gz New: ---- pyte-0.8.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pyte.spec ++++++ --- /var/tmp/diff_new_pack.8gUh28/_old 2018-07-09 13:31:35.562460182 +0200 +++ /var/tmp/diff_new_pack.8gUh28/_new 2018-07-09 13:31:35.562460182 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-pyte # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,14 +17,13 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%bcond_with test Name: python-pyte -Version: 0.7.0 +Version: 0.8.0 Release: 0 Summary: VTXXX-compatible linux terminal emulator -License: LGPL-3.0 +License: LGPL-3.0-only Group: Development/Languages/Python -Url: https://github.com/selectel/pyte +URL: https://github.com/selectel/pyte Source: https://files.pythonhosted.org/packages/source/p/pyte/pyte-%{version}.tar.gz BuildRequires: %{python_module devel} BuildRequires: %{python_module pytest-runner} @@ -46,6 +45,8 @@ %prep %setup -q -n pyte-%{version} +# all fail as missing data files +rm tests/test_input_output.py %build %python_build @@ -53,14 +54,12 @@ %install %python_install -%if %{with test} %check %python_exec setup.py test -%endif %files %{python_files} -%defattr(-,root,root,-) -%doc LICENSE README AUTHORS CHANGES docs/*rst +%license LICENSE +%doc README AUTHORS CHANGES docs/*rst %{python_sitelib}/* %changelog ++++++ pyte-0.7.0.tar.gz -> pyte-0.8.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/AUTHORS new/pyte-0.8.0/AUTHORS --- old/pyte-0.7.0/AUTHORS 2017-10-07 23:04:31.000000000 +0200 +++ new/pyte-0.8.0/AUTHORS 2018-04-06 22:27:48.000000000 +0200 @@ -15,3 +15,4 @@ - Dmitriy Novozhilov - Sergey Zavgorodniy - Byron Roosa +- Andrew Crozier diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/CHANGES new/pyte-0.8.0/CHANGES --- old/pyte-0.7.0/CHANGES 2017-10-07 23:07:08.000000000 +0200 +++ new/pyte-0.8.0/CHANGES 2018-04-06 22:45:10.000000000 +0200 @@ -3,6 +3,31 @@ Here you can see the full list of changes between each pyte release. +Version 0.8.0 +------------- + +Released on April 6th, 2018. + +This release is NOT backward compatible with 0.7.X branch! + +- Modified the logic around tracking position in the ``HistoryScreen``, + allowing the full history to be accessed. See PR #96 on GitHub. +- Send C0 encoded CSI instead of C1, avoiding compatibility issues with + unicode. See issue #99 on GitHub. +- Changed ``Stream`` to really ignore ``SI`` in UTF-8 mode. See PR #106 + on GitHub. Thanks to @jwodder! +- Fixed `DECSCNM` handling bug. The attributes of ``Screen.default_char`` + were not reversed leaving all blank characters as-is. See PR #102 on + GitHub. Thanks to @zblz! +- Correctly terminate OSC mode in ``Stream`` on receipt of a C0 encoded ``ST`` + character. +- Allowed resetting cursor attributes in the middle of the SGR sequence. + See PR#109 on GiHub. Thanks @andreivasiliu! +- On exit from `DECCOLM` mode, restore the terminal width from before entering + `DECCOLM` mode. +- Changed ``Screen.select_graphic_rendition`` to ignore malformed + 256/24bit colours. See issue #115 on GitHub. + Version 0.7.0 ------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/MANIFEST.in new/pyte-0.8.0/MANIFEST.in --- old/pyte-0.7.0/MANIFEST.in 2016-03-14 12:23:17.000000000 +0100 +++ new/pyte-0.8.0/MANIFEST.in 2018-04-06 22:41:25.000000000 +0200 @@ -9,3 +9,4 @@ recursive-include examples *.py recursive-include tests *.py +recursive-include tests/captured diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/PKG-INFO new/pyte-0.8.0/PKG-INFO --- old/pyte-0.7.0/PKG-INFO 2017-10-07 23:08:35.000000000 +0200 +++ new/pyte-0.8.0/PKG-INFO 2018-04-06 22:52:33.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pyte -Version: 0.7.0 +Version: 0.8.0 Summary: Simple VTXXX-compatible terminal emulator. Home-page: https://github.com/selectel/pyte Author: Sergei Lebedev @@ -17,7 +17,7 @@ | |_) || |_| || |_| __/ | .__/ \__, | \__|\___| | | __/ | - |_| |___/ 0.7.0 + |_| |___/ 0.8.0 What is ``pyte``? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/README new/pyte-0.8.0/README --- old/pyte-0.7.0/README 2017-10-07 23:07:42.000000000 +0200 +++ new/pyte-0.8.0/README 2018-04-06 22:45:24.000000000 +0200 @@ -9,7 +9,7 @@ | |_) || |_| || |_| __/ | .__/ \__, | \__|\___| | | __/ | - |_| |___/ 0.7.0 + |_| |___/ 0.8.0 What is ``pyte``? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/docs/conf.py new/pyte-0.8.0/docs/conf.py --- old/pyte-0.7.0/docs/conf.py 2017-10-07 23:07:51.000000000 +0200 +++ new/pyte-0.8.0/docs/conf.py 2018-04-06 22:45:34.000000000 +0200 @@ -52,9 +52,9 @@ # built documents. # # The short X.Y version. -version = '0.7.0' +version = '0.8.0' # The full version, including alpha/beta/rc tags. -release = '0.7.0' +release = '0.8.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/examples/capture.py new/pyte-0.8.0/examples/capture.py --- old/pyte-0.7.0/examples/capture.py 2017-03-27 00:00:30.000000000 +0200 +++ new/pyte-0.8.0/examples/capture.py 2018-04-06 22:40:32.000000000 +0200 @@ -18,8 +18,6 @@ import select import sys -import pyte - if __name__ == "__main__": try: @@ -27,8 +25,6 @@ except ValueError: sys.exit("usage: %prog% output command [args]") - stream = pyte.Stream(pyte.Screen(80, 24)) - p_pid, master_fd = pty.fork() if p_pid == 0: # Child. os.execvpe(argv[0], argv, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/pyte/control.py new/pyte-0.8.0/pyte/control.py --- old/pyte-0.7.0/pyte/control.py 2017-03-22 21:28:56.000000000 +0100 +++ new/pyte-0.8.0/pyte/control.py 2018-04-06 22:27:48.000000000 +0200 @@ -61,11 +61,17 @@ #: *Delete*: Is ignored. DEL = "\x7f" -#: *Control sequence introducer*: An equivalent for ``ESC [``. -CSI = "\x9b" +#: *Control sequence introducer*. +CSI_C0 = ESC + "[" +CSI_C1 = "\x9b" +CSI = CSI_C0 #: *String terminator*. -ST = "\x9c" +ST_C0 = ESC + "\\" +ST_C1 = "\x9c" +ST = ST_C0 #: *Operating system command*. -OSC = "\x9d" +OSC_C0 = ESC + "]" +OSC_C1 = "\x9d" +OSC = OSC_C0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/pyte/graphics.py new/pyte-0.8.0/pyte/graphics.py --- old/pyte-0.7.0/pyte/graphics.py 2017-06-11 21:34:13.000000000 +0200 +++ new/pyte-0.8.0/pyte/graphics.py 2018-04-06 22:27:48.000000000 +0200 @@ -132,17 +132,17 @@ (0xff, 0xff, 0xff), # 15 ] -# colors 16..232: the 6x6x6 color cube +# colors 16..231: the 6x6x6 color cube valuerange = (0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff) -for i in range(217): +for i in range(216): r = valuerange[(i // 36) % 6] g = valuerange[(i // 6) % 6] b = valuerange[i % 6] FG_BG_256.append((r, g, b)) -# colors 233..253: grayscale -for i in range(1, 22): +# colors 232..255: grayscale +for i in range(24): v = 8 + i * 10 FG_BG_256.append((v, v, v)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/pyte/screens.py new/pyte-0.8.0/pyte/screens.py --- old/pyte-0.7.0/pyte/screens.py 2017-10-07 23:02:16.000000000 +0200 +++ new/pyte-0.8.0/pyte/screens.py 2018-04-06 22:32:30.000000000 +0200 @@ -87,8 +87,8 @@ Defaults to ``False``. :param bool italics: flag for rendering the character using italic font. Defaults to ``False``. - :param bool underline: flag for rendering the character underlined. - Defaults to ``False``. + :param bool underscore: flag for rendering the character underlined. + Defaults to ``False``. :param bool strikethrough: flag for rendering the character with a strike-through line. Defaults to ``False``. :param bool reverse: flag for swapping foreground and background colours @@ -210,8 +210,11 @@ for a description of the presentational component, implemented by ``Screen``. """ - #: An empty character with default foreground and background colors. - default_char = Char(data=" ", fg="default", bg="default") + @property + def default_char(self): + """An empty character with default foreground and background colors.""" + reverse = mo.DECSCNM in self.mode + return Char(data=" ", fg="default", bg="default", reverse=reverse) def __init__(self, columns, lines): self.savepoints = [] @@ -279,6 +282,8 @@ self.cursor = Cursor(0, 0) self.cursor_position() + self.saved_columns = None + def resize(self, lines=None, columns=None): """Resize the screen to the given size. @@ -372,6 +377,7 @@ # When DECOLM mode is set, the screen is erased and the cursor # moves to the home position. if mo.DECCOLM in modes: + self.saved_columns = self.columns self.resize(columns=132) self.erase_in_display(2) self.cursor_position() @@ -383,6 +389,7 @@ # Mark all displayed characters as reverse. if mo.DECSCNM in modes: for line in self.buffer.values(): + line.default = self.default_char for x in line: line[x] = line[x]._replace(reverse=True) @@ -409,7 +416,9 @@ # Lines below follow the logic in :meth:`set_mode`. if mo.DECCOLM in modes: - self.resize(columns=80) + if self.columns == 132 and self.saved_columns is not None: + self.resize(columns=self.saved_columns) + self.saved_columns = None self.erase_in_display(2) self.cursor_position() @@ -418,6 +427,7 @@ if mo.DECSCNM in modes: for line in self.buffer.values(): + line.default = self.default_char for x in line: line[x] = line[x]._replace(reverse=False) @@ -964,7 +974,10 @@ while attrs: attr = attrs.pop() - if attr in g.FG_ANSI: + if attr == 0: + # Reset all attributes. + replace.update(self.default_char._asdict()) + elif attr in g.FG_ANSI: replace["fg"] = g.FG_ANSI[attr] elif attr in g.BG: replace["bg"] = g.BG_ANSI[attr] @@ -977,8 +990,8 @@ replace.update(bg=g.BG_AIXTERM[attr], bold=True) elif attr in (g.FG_256, g.BG_256): key = "fg" if attr == g.FG_256 else "bg" - n = attrs.pop() try: + n = attrs.pop() if n == 5: # 256. m = attrs.pop() replace[key] = g.FG_BG_256[m] @@ -1111,7 +1124,7 @@ _wrapped.update(["next_page", "prev_page"]) def __init__(self, columns, lines, history=100, ratio=.5): - self.history = History(deque(maxlen=history // 2), + self.history = History(deque(maxlen=history), deque(maxlen=history), float(ratio), history, @@ -1160,7 +1173,7 @@ # If we're at the bottom of the history buffer and `DECTCEM` # mode is set -- show the cursor. self.cursor.hidden = not ( - abs(self.history.position - self.history.size) < self.lines and + self.history.position == self.history.size and mo.DECTCEM in self.mode ) @@ -1216,7 +1229,7 @@ self.buffer[y] for y in range(self.lines - 1, self.lines - mid - 1, -1)) self.history = self.history \ - ._replace(position=self.history.position - self.lines) + ._replace(position=self.history.position - mid) for y in range(self.lines - 1, mid - 1, -1): self.buffer[y] = self.buffer[y - mid] @@ -1233,7 +1246,7 @@ self.history.top.extend(self.buffer[y] for y in range(mid)) self.history = self.history \ - ._replace(position=self.history.position + self.lines) + ._replace(position=self.history.position + mid) for y in range(self.lines - mid): self.buffer[y] = self.buffer[y + mid] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/pyte/streams.py new/pyte-0.8.0/pyte/streams.py --- old/pyte-0.7.0/pyte/streams.py 2017-06-19 21:56:05.000000000 +0200 +++ new/pyte-0.8.0/pyte/streams.py 2018-04-06 22:27:48.000000000 +0200 @@ -129,7 +129,7 @@ #: A regular expression pattern matching everything what can be #: considered plain text. - _special = set([ctrl.ESC, ctrl.CSI, ctrl.NUL, ctrl.DEL, ctrl.OSC]) + _special = set([ctrl.ESC, ctrl.CSI_C1, ctrl.NUL, ctrl.DEL, ctrl.OSC_C1]) _special.update(basic) _text_pattern = re.compile( "[^" + "".join(map(re.escape, _special)) + "]+") @@ -213,13 +213,14 @@ draw = listener.draw debug = listener.debug - ESC, CSI = ctrl.ESC, ctrl.CSI - OSC, ST = ctrl.OSC, ctrl.ST + ESC, CSI_C1 = ctrl.ESC, ctrl.CSI_C1 + OSC_C1 = ctrl.OSC_C1 SP_OR_GT = ctrl.SP + ">" NUL_OR_DEL = ctrl.NUL + ctrl.DEL CAN_OR_SUB = ctrl.CAN + ctrl.SUB ALLOWED_IN_CSI = "".join([ctrl.BEL, ctrl.BS, ctrl.HT, ctrl.LF, ctrl.VT, ctrl.FF, ctrl.CR]) + OSC_TERMINATORS = set([ctrl.ST_C0, ctrl.ST_C1, ctrl.BEL]) def create_dispatcher(mapping): return defaultdict(lambda: debug, dict( @@ -251,9 +252,9 @@ # are noop. char = yield if char == "[": - char = CSI # Go to CSI. + char = CSI_C1 # Go to CSI. elif char == "]": - char = OSC # Go to OSC. + char = OSC_C1 # Go to OSC. else: if char == "#": sharp_dispatch[(yield)]() @@ -275,11 +276,11 @@ # Ignore shifts in UTF-8 mode. See # http://www.cl.cam.ac.uk/~mgk25/unicode.html#term for # the why on UTF-8 restriction. - if char == ctrl.SI or char == ctrl.SO and self.use_utf8: + if (char == ctrl.SI or char == ctrl.SO) and self.use_utf8: continue basic_dispatch[char]() - elif char == CSI: + elif char == CSI_C1: # All parameters are unsigned, positive decimal integers, with # the most significant digit sent first. Any parameter greater # than 9999 is set to 9999. If you do not specify a value, a 0 @@ -324,7 +325,7 @@ else: csi_dispatch[char](*params) break # CSI is finished. - elif char == OSC: + elif char == OSC_C1: code = yield if code == "R": continue # Reset palette. Not implemented. @@ -334,7 +335,9 @@ param = "" while True: char = yield - if char == ST or char == ctrl.BEL: + if char == ESC: + char += yield + if char in OSC_TERMINATORS: break else: param += char diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/pyte.egg-info/PKG-INFO new/pyte-0.8.0/pyte.egg-info/PKG-INFO --- old/pyte-0.7.0/pyte.egg-info/PKG-INFO 2017-10-07 23:08:32.000000000 +0200 +++ new/pyte-0.8.0/pyte.egg-info/PKG-INFO 2018-04-06 22:52:32.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pyte -Version: 0.7.0 +Version: 0.8.0 Summary: Simple VTXXX-compatible terminal emulator. Home-page: https://github.com/selectel/pyte Author: Sergei Lebedev @@ -17,7 +17,7 @@ | |_) || |_| || |_| __/ | .__/ \__, | \__|\___| | | __/ | - |_| |___/ 0.7.0 + |_| |___/ 0.8.0 What is ``pyte``? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/setup.cfg new/pyte-0.8.0/setup.cfg --- old/pyte-0.7.0/setup.cfg 2017-10-07 23:08:35.000000000 +0200 +++ new/pyte-0.8.0/setup.cfg 2018-04-06 22:52:33.000000000 +0200 @@ -4,5 +4,4 @@ [egg_info] tag_build = tag_date = 0 -tag_svn_revision = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/setup.py new/pyte-0.8.0/setup.py --- old/pyte-0.7.0/setup.py 2017-10-07 23:07:28.000000000 +0200 +++ new/pyte-0.8.0/setup.py 2018-04-06 22:45:15.000000000 +0200 @@ -31,7 +31,7 @@ setup(name="pyte", - version="0.7.0", + version="0.8.0", packages=["pyte"], install_requires=["wcwidth"], setup_requires=["pytest-runner"], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/tests/test_history.py new/pyte-0.8.0/tests/test_history.py --- old/pyte-0.7.0/tests/test_history.py 2017-05-28 14:14:04.000000000 +0200 +++ new/pyte-0.8.0/tests/test_history.py 2018-04-06 22:27:48.000000000 +0200 @@ -40,10 +40,10 @@ assert screen.history.top[-1] == line # c) rotation. - for _ in range(screen.lines * screen.lines): + for _ in range(screen.history.size * 2): screen.index() - assert len(screen.history.top) == 25 # pages // 2 * lines + assert len(screen.history.top) == 50 def test_reverse_index(): @@ -111,7 +111,7 @@ # a) first page up. screen.prev_page() - assert screen.history.position == 36 + assert screen.history.position == 38 assert len(screen.buffer) == screen.lines assert screen.display == [ "35 ", @@ -135,7 +135,7 @@ # b) second page up. screen.prev_page() - assert screen.history.position == 32 + assert screen.history.position == 36 assert len(screen.buffer) == screen.lines assert screen.display == [ "33 ", @@ -172,7 +172,7 @@ ] screen.prev_page() - assert screen.history.position == 45 + assert screen.history.position == 47 assert screen.display == [ "43 ", "44 ", @@ -188,7 +188,41 @@ " ", ] - # d) same with cursor in the middle of the screen. + # d) with a ratio other than 0.5 + screen = pyte.HistoryScreen(4, 4, history=40, ratio=0.75) + screen.set_mode(mo.LNM) + + for idx in range(screen.lines * 10): + screen.draw(str(idx)) + screen.linefeed() + + assert screen.history.top + assert not screen.history.bottom + assert screen.history.position == 40 + assert screen.display == [ + "37 ", + "38 ", + "39 ", + " " + ] + + screen.prev_page() + assert screen.history.position == 37 + assert screen.display == [ + "34 ", + "35 ", + "36 ", + "37 " + ] + + assert len(screen.history.bottom) == 3 + assert chars(screen.history.bottom, screen.columns) == [ + "38 ", + "39 ", + " " + ] + + # e) same with cursor in the middle of the screen. screen = pyte.HistoryScreen(5, 5, history=50) screen.set_mode(mo.LNM) @@ -215,11 +249,11 @@ assert screen.history.position == screen.lines assert len(screen.buffer) == screen.lines assert screen.display == [ - "21 ", - "22 ", - "23 ", - "24 ", - "25 " + "1 ", + "2 ", + "3 ", + "4 ", + "5 " ] while screen.history.position < screen.history.size: @@ -262,11 +296,11 @@ assert screen.history.position == screen.lines assert len(screen.buffer) == screen.lines assert screen.display == [ - "21 ", - "22 ", - "23 ", - "24 ", - "25 " + "1 ", + "2 ", + "3 ", + "4 ", + "5 " ] while screen.history.position < screen.history.size: @@ -322,7 +356,7 @@ screen.prev_page() screen.prev_page() screen.next_page() - assert screen.history.position == 45 + assert screen.history.position == 47 assert screen.history.top assert chars(screen.history.bottom, screen.columns) == [ "23 ", @@ -343,7 +377,7 @@ screen.prev_page() screen.next_page() screen.next_page() - assert screen.history.position == 45 + assert screen.history.position == 47 assert len(screen.buffer) == screen.lines assert screen.display == [ "18 ", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/tests/test_screen.py new/pyte-0.8.0/tests/test_screen.py --- old/pyte-0.7.0/tests/test_screen.py 2017-10-07 23:02:16.000000000 +0200 +++ new/pyte-0.8.0/tests/test_screen.py 2018-04-06 22:35:35.000000000 +0200 @@ -7,7 +7,7 @@ import pytest import pyte -from pyte import modes as mo, control as ctrl +from pyte import modes as mo, control as ctrl, graphics as g from pyte.screens import Char @@ -85,8 +85,8 @@ screen = pyte.Screen(2, 2) # a) OK-case. - screen.select_graphic_rendition(38, 5, 0) - screen.select_graphic_rendition(48, 5, 15) + screen.select_graphic_rendition(g.FG_256, 5, 0) + screen.select_graphic_rendition(g.BG_256, 5, 15) assert screen.cursor.attrs.fg == "000000" assert screen.cursor.attrs.bg == "ffffff" @@ -94,6 +94,14 @@ screen.select_graphic_rendition(48, 5, 100500) +def test_colors256_missing_attrs(): + # Test from https://github.com/selectel/pyte/issues/115 + screen = pyte.Screen(2, 2) + screen.select_graphic_rendition(g.FG_256) + screen.select_graphic_rendition(g.BG_256) + assert screen.cursor.attrs == screen.default_char + + def test_colors24bit(): screen = pyte.Screen(2, 2) @@ -149,6 +157,16 @@ assert screen.cursor.attrs == screen.default_char +def test_reset_works_between_attributes(): + screen = pyte.Screen(2, 2) + assert tolist(screen) == [[screen.default_char, screen.default_char]] * 2 + + # Red fg, reset, red bg + screen.select_graphic_rendition(31, 0, 41) + assert screen.cursor.attrs.fg == "default" + assert screen.cursor.attrs.bg == "red" + + def test_multi_attribs(): screen = pyte.Screen(2, 2) assert tolist(screen) == [[screen.default_char, screen.default_char]] * 2 @@ -246,7 +264,7 @@ assert screen.cursor.x == 0 assert screen.cursor.y == 0 screen.reset_mode(mo.DECCOLM) - assert screen.columns == 80 + assert screen.columns == 3 # Test mo.DECOM mode screen = update(pyte.Screen(3, 3), ["sam", "is ", "foo"]) @@ -261,10 +279,12 @@ for line in range(3): for char in tolist(screen)[line]: assert char.reverse + assert screen.default_char.reverse screen.reset_mode(mo.DECSCNM) for line in range(3): for char in tolist(screen)[line]: assert not char.reverse + assert not screen.default_char.reverse # Test mo.DECTCEM mode screen = update(pyte.Screen(3, 3), ["sam", "is ", "foo"]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyte-0.7.0/tests/test_stream.py new/pyte-0.8.0/tests/test_stream.py --- old/pyte-0.7.0/tests/test_stream.py 2017-06-11 21:30:40.000000000 +0200 +++ new/pyte-0.8.0/tests/test_stream.py 2018-04-06 22:27:48.000000000 +0200 @@ -179,24 +179,30 @@ assert handler.args == (10, 10) -def test_set_title_icon_name(): [email protected]('osc,st', [ + (ctrl.OSC_C0, ctrl.ST_C0), + (ctrl.OSC_C0, ctrl.ST_C1), + (ctrl.OSC_C1, ctrl.ST_C0), + (ctrl.OSC_C1, ctrl.ST_C1) +]) +def test_set_title_icon_name(osc, st): screen = pyte.Screen(80, 24) stream = pyte.Stream(screen) # a) set only icon name - stream.feed(ctrl.OSC + "1;foo" + ctrl.ST) + stream.feed(osc + "1;foo" + st) assert screen.icon_name == "foo" # b) set only title - stream.feed(ctrl.OSC + "2;foo" + ctrl.ST) + stream.feed(osc + "2;foo" + st) assert screen.title == "foo" # c) set both icon name and title - stream.feed(ctrl.OSC + "0;bar" + ctrl.ST) + stream.feed(osc + "0;bar" + st) assert screen.title == screen.icon_name == "bar" # d) set both icon name and title then terminate with BEL - stream.feed(ctrl.OSC + "0;bar" + ctrl.BEL) + stream.feed(osc + "0;bar" + st) assert screen.title == screen.icon_name == "bar" # e) test ➜ ('\xe2\x9e\x9c') symbol, that contains string terminator \x9c @@ -228,6 +234,16 @@ assert screen.display[0] == " " * 3 +def test_non_utf8_shifts(): + screen = pyte.Screen(3, 3) + handler = screen.shift_in = screen.shift_out = argcheck() + stream = pyte.Stream(screen) + stream.use_utf8 = False + stream.feed(ctrl.SI) + stream.feed(ctrl.SO) + assert handler.count == 2 + + @pytest.mark.parametrize("input,expected", [ (b"foo", [["draw", ["foo"], {}]]), (b"\x1b[1;24r\x1b[4l\x1b[24;1H", [
