[Twisted-Python] Embedding manhole interpreter into insults widget.

Glyph Lefkowitz glyph at twistedmatrix.com
Wed Aug 6 13:48:42 MDT 2014


On Aug 6, 2014, at 11:14 AM, Maxim Lacrima <lacrima.maxim at gmail.com> wrote:

> The reason is that on each keystroke, the whole terminal buffer is redrawn. I wonder how I can optimize this. Currently I don't see a solution. Also I am wondering if I took right approach to embed manhole interpreter into a widget in the first place, but I don't see a solution, except using `TerminalBuffer` to capture manhole output.

Optimizing this will almost certainly involve patching Twisted.  Which you should definitely do :).

The reason the entire screen is redrawn is that a general implementation of a widget, i.e. one that can be displayed anywhere on the terminal, you do just have to redraw the entire widget when certain things happen, like when the screen scrolls.  You can see this in other software by observing the fairly significant performance difference between a vertical split and a horizontal split in tmux.  Nothing to do with Twisted there, just a general limitation of terminals.

The optimizations you could implement are one where inputting individual characters doesn't cause a full screen redraw, and avoiding a full screen redraw when scrolling if the edges of the widget touch the edges of the full terminal (setting up a scroll area for that case).

I think that using a widget for this case does indeed make sense (just as I'm super glad that tmux has vertical splits, even if they're kinda slow), and it would be great to get these optimizations into Twisted.

-glyph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20140806/6e9447a0/attachment-0002.html>


More information about the Twisted-Python mailing list