Skip to content

Commit

Permalink
Merge pull request ajenti#883 from Xefir/fix-terminal
Browse files Browse the repository at this point in the history
Update Pyte to fix ajenti#878
  • Loading branch information
Eugeny committed Feb 25, 2016
2 parents 9d09056 + 70838f0 commit 60be1f1
Show file tree
Hide file tree
Showing 9 changed files with 225 additions and 26 deletions.
1 change: 0 additions & 1 deletion ajenti/plugins/terminal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def refresh(self):
thumb.on('close', self.on_close, k)
ulist.append(thumb)


def run_shell(self, command=None, autoopen=False, autoclose=True, callback=None, **kwargs):
if not command:
command = self.classconfig['shell']
Expand Down
2 changes: 2 additions & 0 deletions ajenti/plugins/terminal/pyte/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ Contributors
- Alexey Shamrin
- Steve Cohen
- Jonathan Slenders
- David O'Shea
- Andreas Stührk
159 changes: 159 additions & 0 deletions ajenti/plugins/terminal/pyte/CHANGES
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
pyte Changelog
==============

Here you can see the full list of changes between each pyte release.

Version 0.4.10
--------------

Bugfix release, released on August 4th 2015

- Fixed a bug in `pyte.screens.DiffScreen.draw` which marked the wrong
line as changed when `DECAWM` was enabled.
- `pyte.streams.Stream` now recognizes ESC % sequences for selecting control
character set. However, these operations are no-op in the current version
in a sense that `pyte.streams.ByteStream` does not handle them to change
encoding.


Version 0.4.9
-------------

Bugfix release, released on December 3rd 2014

- Fixed a bug in `pyte.screens.Char` initialisation, see issue #24
on GitHub for details.
- Updated error message in `pyte.streams.Stream`, referencing `str`
is relevant for Python 3, but not Python 2.


Version 0.4.8
-------------

Released on January 13th 2014

- `pyte.screens.Screen` does NOT inherit from builtin `list`, use
`screen.buffer` to access individual characters directly. This is
a backward INCOMPATIBLE change.
- `pyte.screens.Char._asdict` was broken on Python 3.3 because of the
changes in `namedtuple` implementation.
- `pyte.charsets.LAT1_MAP` was an iterator because of the change in map
semantics in Python 3
- Changed `pyte.screens.Screen` to issues a CR in addition to LF when
`DECAWM` mode is set and the cursor is at the right border of the
screen. See http://www.vt100.net/docs/vt510-rm/DECAWM and issue #20
on GitHub for details.

Version 0.4.7
-------------

Bugfix release, released on March 28th 2013

- Updated `pyte` and tests suite to work under Python 3.3.
- Changed `pyte.screens.Screen` so that `LNM` mode is reset by default,
see http://www.vt100.net/docs/vt510-rm/LNM and issue #11 on GitHub for
details.

Version 0.4.6
-------------

Bugfix release, released on February 29th 2012

Version 0.4.5
-------------

Technical release, released on September 1st 2011

- Created MANIFEST.in file
- Added CentOS spec file

Version 0.4.4
-------------

Bugfix release, released on July 17th 2011

- Removed `pdb` calls, left from `HistoryScreen` debugging -- silly,
I know :)

Version 0.4.3
-------------

Bugfix release, released on July 12th 2011

- Fixed encoding issues in `DebugStream` -- Unicode was not converted
to bytes properly.
- Fixed G0-1 charset handling and added VAX42 charset for the ancient
stuff to work correctly.

Version 0.4.2
-------------

Bugfix release, released on June 27th 2011

- Added a tiny debugging helper: ``python -m pyte your escape codes``
- Added ``Screen.__{before,after}__()`` hooks to ``Screen`` -- now
subclasses can extend more than one command easily.
- Fixed ``HistoryScreen`` -- now not as buggy as it used to be:
and allows for custom ratio aspect when browsing history, see
``HistoryScreen`` documentation for details.
- Fixed `DECTCEM` private mode handling -- when the mode is reset
``Screen.cursor.hidden`` is ``True`` otherwise it's ``False``.

Version 0.4.1
-------------

Bugfix release, released on June 21st 2011

- Minor examples and documentation update before the first public
release.

Version 0.4.0
-------------

Released on June 21st 2011

- Improved cursor movement -- ``Screen`` passes all but one tests
in `vttest`.
- Changed the way ``Stream`` interacts with ``Screen`` -- event
handlers are now implicitly looked up in screen's ``__dict__``,
not connected manually.
- Changed cursor API -- cursor position and attributes are encapsulated
in a separate ``Cursor`` class.
- Added support for `DECSCNM` -- toggle screen-wide reverse-video mode.
- Added a couple of useful ``Screen`` subclasses: ``HistoryScreen``
which allows screen pagination and ``DiffScreen`` which tracks
the changed lines.

Version 0.3.9
-------------

Released on May 31st 2011

- Added initial support for G0-1 charsets (mappings taken from ``tty``
kernel driver) and SI, SO escape sequences.
- Changed ``ByteStream`` to support fallback encodings -- it nows
takes a list of ``(encoding, errors)`` pairs and traverses it
left to right on ``feed()``.
- Switched to ``unicode_literals`` -- one step closer to Python3.

Version 0.3.8
-------------

Released on May 23rd 2011

- Major rewrite of ``Screen`` internals -- highlights: inherits from
``list``; each character is represented by ``namedtuple`` which
also holds SGR data.
- Numerous bugfixes, especialy in methods, dealing with manipulating
character attributes.

Version 0.3.7
-------------

First release after the adoption -- skipped a few version to reflect that.
Released on May 16th 2011

- Added support for ANSI color codes, as listed in ``man console_codes``.
Not implemnted yet: setting alternate font, setting and resetting
mappings, blinking text.
- Added a couple of trivial usage examples in the `examples/` dir.
2 changes: 1 addition & 1 deletion ajenti/plugins/terminal/pyte/README
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| |_) || |_| || |_| __/
| .__/ \__, | \__|\___|
| | __/ |
|_| |___/ 0.4.8
|_| |___/ 0.4.10


What is ``pyte``?
Expand Down
2 changes: 1 addition & 1 deletion ajenti/plugins/terminal/pyte/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#: *Escape*: Starts an escape sequence.
ESC = "\u001b"

#: *Delete*: Is ingored.
#: *Delete*: Is ignored.
DEL = "\u007f"

#: *Control sequence introducer*: An equavalent for ``ESC [``.
Expand Down
15 changes: 14 additions & 1 deletion ajenti/plugins/terminal/pyte/escape.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
pyte.escape
~~~~~~~~~~~
This module defines bot CSI and non-CSI escape sequences, recognized
This module defines both CSI and non-CSI escape sequences, recognized
by :class:`~pyte.streams.Stream` and subclasses.
:copyright: (c) 2011-2013 by Selectel, see AUTHORS for details.
Expand Down Expand Up @@ -41,6 +41,19 @@
DECRC = "8"


# "Percent" escape sequences.
# ---------------------------

#: *Select default (ISO 646 / ISO 8859-1)*.
DEFAULT = "@"

#: *Select UTF-8*.
UTF8 = "G"

#: *Select UTF-8 (obsolete)*.
UTF8_OBSOLETE = "8"


# "Sharp" escape sequences.
# -------------------------

Expand Down
11 changes: 7 additions & 4 deletions ajenti/plugins/terminal/pyte/screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __new__(cls, data, fg="default", bg="default", bold=False,
italics=False, underscore=False, reverse=False,
strikethrough=False):
return _Char.__new__(cls, data, fg, bg, bold, italics, underscore,
reverse, strikethrough)
strikethrough, reverse)


class Cursor(object):
Expand Down Expand Up @@ -624,7 +624,7 @@ def erase_in_line(self, type_of=0, private=False):
* ``1`` -- Erases from beginning of line to cursor,
including cursor position.
* ``2`` -- Erases complete line.
:param bool private: when ``True`` character attributes aren left
:param bool private: when ``True`` character attributes are left
unchanged **not implemented**.
"""
interval = (
Expand Down Expand Up @@ -652,7 +652,7 @@ def erase_in_display(self, type_of=0, private=False):
including cursor position.
* ``2`` -- Erases complete display. All lines are erased
and changed to single-width. Cursor does not move.
:param bool private: when ``True`` character attributes aren left
:param bool private: when ``True`` character attributes are left
unchanged **not implemented**.
"""
interval = (
Expand Down Expand Up @@ -883,8 +883,11 @@ def resize(self, *args, **kwargs):
super(DiffScreen, self).resize(*args, **kwargs)

def draw(self, *args):
self.dirty.add(self.cursor.y)
# Call the superclass's method before marking the row as
# dirty, as when wrapping is enabled, draw() might change
# self.cursor.y.
super(DiffScreen, self).draw(*args)
self.dirty.add(self.cursor.y)

def index(self):
if self.cursor.y == self.margins.bottom:
Expand Down
Loading

0 comments on commit 60be1f1

Please sign in to comment.