Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`conch`.`insults`.`helper`.`TerminalBuffer``

class documentation

`class TerminalBuffer(protocol.Protocol): (source)`

Known subclasses: `twisted.conch.insults.helper.ExpectableBuffer`

Implements interfaces: `twisted.conch.insults.insults.ITerminalTransport`

View In Hierarchy

An in-memory terminal emulator.

Method | `__bytes__` | Undocumented
Method | `applicationKeypadMode` | Cause keypad to generate control functions.
Method | `connectionMade` | Called when a connection is made.
Method | `cursorBackward` | Move the cursor left n columns.
Method | `cursorDown` | Move the cursor down n lines.
Method | `cursorForward` | Move the cursor right n columns.
Method | `cursorHome` | Move the cursor home.
Method | `cursorPosition` | Move the cursor to the given line and column.
Method | `cursorUp` | Move the cursor up n lines.
Method | `deleteCharacter` | Delete n characters starting at the cursor position.
Method | `deleteLine` | Delete n lines starting at the cursor position.
Method | `doubleHeightLine` | Make the current line the top or bottom half of a double-height, double-width line.
Method | `doubleWidthLine` | Make the current line a double-width line.
Method | `eraseDisplay` | Erase the entire display.
Method | `eraseLine` | Erase the entire cursor line.
Method | `eraseToDisplayBeginning` | Erase from the cursor to the beginning of the display, including the cursor position.
Method | `eraseToDisplayEnd` | Erase from the cursor to the end of the display, including the cursor position.
Method | `eraseToLineBeginning` | Erase from the cursor to the beginning of the line, including the cursor position.
Method | `eraseToLineEnd` | Erase from the cursor to the end of line, including cursor position.
Method | `getCharacter` | Undocumented
Method | `getHost` | Similar to getPeer, but returns an address describing this side of the connection.
Method | `getPeer` | Get the remote address of this connection.
Method | `horizontalTabulationSet` | Set a tab stop at the current cursor position.
Method | `index` | Move the cursor down one line, performing scrolling if necessary.
Method | `insertAtCursor` | Add one byte to the terminal at the cursor and make consequent state updates.
Method | `insertLine` | Insert n lines at the cursor position.
Method | `loseConnection` | Close my connection, after writing all pending data.
Method | `nextLine` | Update the cursor position attributes and scroll down if appropriate.
Method | `numericKeypadMode` | Cause keypad to generate normal characters.
Method | `reportCursorPosition` | Return a Deferred that fires with a two-tuple of (x, y) indicating the cursor position.
Method | `reset` | Reset the terminal to its initial state.
Method | `resetModes` | Reset the given modes on the terminal.
Method | `resetPrivateModes` | Disable the given modes.
Method | `restoreCursor` | Restore the previously saved cursor position, character attribute, character set, and origin mode selection.
Method | `reverseIndex` | Move the cursor up one line, performing scrolling if necessary.
Method | `saveCursor` | Save the cursor position, character attribute, character set, and origin mode selection.
Method | `selectCharacterSet` | Select a character set.
Method | `selectGraphicRendition` | Enabled one or more character attributes.
Method | `setModes` | Set the given modes on the terminal.
Method | `setPrivateModes` | Enable the given modes.
Method | `shiftIn` | Activate the G0 character set.
Method | `shiftOut` | Activate the G1 character set.
Method | `singleShift2` | Shift to the G2 character set for a single character.
Method | `singleShift3` | Shift to the G3 character set for a single character.
Method | `singleWidthLine` | Make the current line a single-width, single-height line.
Method | `tabulationClear` | Clear the tab stop at the current cursor position.
Method | `tabulationClearAll` | Clear all tab stops.
Method | `unhandledControlSequence` | Called when an unsupported control sequence is received.
Method | `write` | Add the given printable bytes to the terminal.
Method | `writeSequence` | Write an iterable of byte strings to the physical connection.
Constant | `BACKSPACE` | Undocumented
Constant | `TAB` | Undocumented
Class Variable | `execBytes` | Undocumented
Class Variable | `execStr` | Undocumented
Class Variable | `fill` | Undocumented
Class Variable | `height` | Undocumented
Class Variable | `void` | Undocumented
Class Variable | `width` | Undocumented
Instance Variable | `activeCharset` | Undocumented
Instance Variable | `charsets` | Undocumented
Instance Variable | `graphicRendition` | Undocumented
Instance Variable | `home` | Undocumented
Instance Variable | `keypadMode` | Undocumented
Instance Variable | `lines` | Undocumented
Instance Variable | `modes` | Undocumented
Instance Variable | `numericKeypad` | Undocumented
Instance Variable | `privateModes` | Undocumented
Instance Variable | `x` | Undocumented
Instance Variable | `y` | Undocumented
Method | `_currentFormattingState` | Undocumented
Method | `_emptyLine` | Undocumented
Method | `_scrollDown` | Undocumented
Method | `_scrollUp` | Undocumented
Class Variable | `_log` | Undocumented
Instance Variable | `_savedCursor` | Undocumented

Inherited from `Protocol`:

Method | `connectionLost` | Called when the connection is shut down.
Method | `dataReceived` | Called whenever data is received.
Method | `logPrefix` | Return a prefix matching the class name, to identify log messages related to this protocol instance.
Class Variable | `factory` | Undocumented

Inherited from `BaseProtocol` (via `Protocol`):

Method | `makeConnection` | Make a connection to a transport and a server.
Instance Variable | `connected` | Undocumented
Instance Variable | `transport` | Undocumented

def __bytes__(self): (source)

Undocumented

def applicationKeypadMode(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Cause keypad to generate control functions.

Cursor key mode selects the type of characters generated by cursor keys.

def connectionMade(self): (source)
from `twisted.internet.interfaces.IProtocol`
overrides `twisted.internet.protocol.BaseProtocol.connectionMade`
overridden in `twisted.conch.insults.helper.ExpectableBuffer`

Called when a connection is made.

This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.

def cursorBackward(self, n=1): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Move the cursor left n columns.

def cursorDown(self, n=1): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Move the cursor down n lines.

def cursorForward(self, n=1): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Move the cursor right n columns.

def cursorHome(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`
overridden in `twisted.conch.insults.helper.ExpectableBuffer`

Move the cursor home.

def cursorPosition(self, column, line): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Move the cursor to the given line and column.

def cursorUp(self, n=1): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Move the cursor up n lines.

def deleteCharacter(self, n=1): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Delete n characters starting at the cursor position.

Characters to the right of deleted characters are shifted to the left.

def deleteLine(self, n=1): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Delete n lines starting at the cursor position.

Lines below the cursor are shifted up. This command is ignored when the cursor is outside the scroll region.

def doubleHeightLine(self, top=True): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Make the current line the top or bottom half of a double-height, double-width line.

If top is True, the current line is the top half. Otherwise, it is the bottom half.

def doubleWidthLine(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Make the current line a double-width line.

def eraseDisplay(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Erase the entire display.

def eraseLine(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Erase the entire cursor line.

def eraseToDisplayBeginning(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Erase from the cursor to the beginning of the display, including the cursor position.

def eraseToDisplayEnd(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Erase from the cursor to the end of the display, including the cursor position.

def eraseToLineBeginning(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Erase from the cursor to the beginning of the line, including the cursor position.

def eraseToLineEnd(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Erase from the cursor to the end of line, including cursor position.

def getCharacter(self, x, y): (source)

Undocumented

def getHost(self): (source)
from `twisted.internet.interfaces.ITransport`

Similar to getPeer, but returns an address describing this side of the connection.

Returns
An `IAddress` provider.

def getPeer(self): (source)
from `twisted.internet.interfaces.ITransport`

Get the remote address of this connection.

Treat this method with caution. It is the unfortunate result of the CGI and Jabber standards, but should not be considered reliable for the usual host of reasons; port forwarding, proxying, firewalls, IP masquerading, etc.

Returns
An `IAddress` provider.

def horizontalTabulationSet(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Set a tab stop at the current cursor position.

def index(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Move the cursor down one line, performing scrolling if necessary.

def insertAtCursor(self, b): (source)

Add one byte to the terminal at the cursor and make consequent state updates.

If b is a carriage return, move the cursor to the beginning of the current row.

If b is a line feed, move the cursor to the next row or scroll down if the cursor is already in the last row.

Otherwise, if b is printable, put it at the cursor position (inserting or overwriting as dictated by the current mode) and move the cursor.

def insertLine(self, n=1): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Insert n lines at the cursor position.

Lines below the cursor are shifted down. Lines moved past the bottom margin are lost. This command is ignored when the cursor is outside the scroll region.

def loseConnection(self): (source)
from `twisted.internet.interfaces.ITransport`

Close my connection, after writing all pending data.

Note that if there is a registered producer on a transport it will not be closed until the producer has been unregistered.

def nextLine(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Update the cursor position attributes and scroll down if appropriate.

def numericKeypadMode(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Cause keypad to generate normal characters.

def reportCursorPosition(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Return a Deferred that fires with a two-tuple of (x, y) indicating the cursor position.

def reset(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Reset the terminal to its initial state.

def resetModes(self, modes): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Reset the given modes on the terminal.

def resetPrivateModes(self, modes): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Disable the given modes.

See Also
`setPrivateModes`
`insults.ITerminalTransport.resetPrivateModes`

def restoreCursor(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Restore the previously saved cursor position, character attribute, character set, and origin mode selection.

If no cursor state was previously saved, move the cursor to the home position.

def reverseIndex(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Move the cursor up one line, performing scrolling if necessary.

def saveCursor(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Save the cursor position, character attribute, character set, and origin mode selection.

def selectCharacterSet(self, charSet, which): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Select a character set.

charSet should be one of CS_US, CS_UK, CS_DRAWING, CS_ALTERNATE, or CS_ALTERNATE_SPECIAL.

which should be one of G0 or G1.

def selectGraphicRendition(self, *attributes): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Enabled one or more character attributes.

Arguments should be one or more of UNDERLINE, REVERSE_VIDEO, BLINK, or BOLD. NORMAL may also be specified to disable all character attributes.

def setModes(self, modes): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Set the given modes on the terminal.

def setPrivateModes(self, modes): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Enable the given modes.

Track which modes have been enabled so that the implementations of other `insults.ITerminalTransport` methods can be properly implemented to respect these settings.

See Also
`resetPrivateModes`
`insults.ITerminalTransport.setPrivateModes`

def shiftIn(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Activate the G0 character set.

def shiftOut(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Activate the G1 character set.

def singleShift2(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Shift to the G2 character set for a single character.

def singleShift3(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Shift to the G3 character set for a single character.

def singleWidthLine(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Make the current line a single-width, single-height line.

def tabulationClear(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Clear the tab stop at the current cursor position.

def tabulationClearAll(self): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Clear all tab stops.

def unhandledControlSequence(self, buf): (source)
from `twisted.conch.insults.insults.ITerminalTransport`

Called when an unsupported control sequence is received.

Parameters
buf | Undocumented
seq:`str` | The whole control sequence which could not be interpreted.

def write(self, data): (source)
from `twisted.internet.interfaces.ITransport`
overridden in `twisted.conch.insults.helper.ExpectableBuffer`

Add the given printable bytes to the terminal.

Line feeds in `bytes` will be replaced with carriage return / line feed pairs.

def writeSequence(self, data): (source)
from `twisted.internet.interfaces.ITransport`

Write an iterable of byte strings to the physical connection.

If possible, make sure that all of the data is written to the socket at once, without first copying it all into a single byte string.

Parameters
data | The data to write.

BACKSPACE: `bytes` = (source)

Undocumented

Value

    b'\x7f'

TAB: `bytes` = (source)

Undocumented

Value

    b'\t'

execBytes = (source)

Undocumented

execStr = (source)

Undocumented

fill: `bytes` = (source)

Undocumented

height: `int` = (source)

Undocumented

void = (source)

Undocumented

width: `int` = (source)

Undocumented

activeCharset = (source)

Undocumented

charsets = (source)

Undocumented

graphicRendition = (source)

Undocumented

home = (source)

Undocumented

keypadMode: `str` = (source)

Undocumented

lines = (source)

Undocumented

modes: `dict` = (source)

Undocumented

numericKeypad: `str` = (source)

Undocumented

privateModes: `dict` = (source)

Undocumented

x: `int` = (source)

Undocumented

y: `int` = (source)

Undocumented

def _currentFormattingState(self): (source)

Undocumented

def _emptyLine(self, width): (source)

Undocumented

def _scrollDown(self): (source)

Undocumented

def _scrollUp(self): (source)

Undocumented

_log = (source)

Undocumented

_savedCursor = (source)

Undocumented