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

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

An in-memory terminal emulator.

Method getCharacter Undocumented
Method connectionMade Called when a connection is made.
Method write Add the given printable bytes to the terminal.
Method insertAtCursor Add one byte to the terminal at the cursor and make consequent state updates.
Method cursorUp Move the cursor up n lines.
Method cursorDown Move the cursor down n lines.
Method cursorBackward Move the cursor left n columns.
Method cursorForward Move the cursor right n columns.
Method cursorPosition Move the cursor to the given line and column.
Method cursorHome Move the cursor home.
Method index Move the cursor down one line, performing scrolling if necessary.
Method reverseIndex Move the cursor up one line, performing scrolling if necessary.
Method nextLine Update the cursor position attributes and scroll down if appropriate.
Method saveCursor Save the cursor position, character attribute, character set, and origin mode selection.
Method restoreCursor Restore the previously saved cursor position, character attribute, character set, and origin mode selection.
Method setModes Set the given modes on the terminal.
Method resetModes Reset the given modes on the terminal.
Method setPrivateModes Enable the given modes.
Method resetPrivateModes Disable the given modes.
Method applicationKeypadMode Cause keypad to generate control functions.
Method numericKeypadMode Cause keypad to generate normal characters.
Method selectCharacterSet Select a character set.
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 selectGraphicRendition Enabled one or more character attributes.
Method eraseLine Erase the entire cursor line.
Method eraseToLineEnd Erase from the cursor to the end of line, including cursor position.
Method eraseToLineBeginning Erase from the cursor to the beginning of the line, including the cursor position.
Method eraseDisplay Erase the entire display.
Method eraseToDisplayEnd Erase from the cursor to the end of the display, including the cursor position.
Method eraseToDisplayBeginning Erase from the cursor to the beginning of the display, including the cursor position.
Method deleteCharacter Delete n characters starting at the cursor position.
Method insertLine Insert n lines at the cursor position.
Method deleteLine Delete n lines starting at the cursor position.
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 unhandledControlSequence Called when an unsupported control sequence is received.
Method __bytes__ Undocumented
Method _currentFormattingState Undocumented
Method _emptyLine Undocumented
Method _scrollDown Undocumented
Method _scrollUp Undocumented

Inherited from Protocol:

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

Inherited from BaseProtocol (via Protocol):

Method makeConnection Make a connection to a transport and a server.
def getCharacter(self, x, y): (source)
Undocumented
def connectionMade(self): (source)

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 write(self, data): (source)

Add the given printable bytes to the terminal.

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

def _currentFormattingState(self): (source)
Undocumented
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 _emptyLine(self, width): (source)
Undocumented
def _scrollDown(self): (source)
Undocumented
def _scrollUp(self): (source)
Undocumented
def cursorUp(self, n=1): (source)

Move the cursor up n lines.

def cursorDown(self, n=1): (source)

Move the cursor down n lines.

def cursorBackward(self, n=1): (source)

Move the cursor left n columns.

def cursorForward(self, n=1): (source)

Move the cursor right n columns.

def cursorPosition(self, column, line): (source)

Move the cursor to the given line and column.

def index(self): (source)

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

def reverseIndex(self): (source)

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

def nextLine(self): (source)

Update the cursor position attributes and scroll down if appropriate.

def saveCursor(self): (source)

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

def restoreCursor(self): (source)

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 setModes(self, modes): (source)

Set the given modes on the terminal.

def resetModes(self, modes): (source)

Reset the given modes on the terminal.

def setPrivateModes(self, modes): (source)

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 AlsoresetPrivateModes
insults.ITerminalTransport.setPrivateModes
def applicationKeypadMode(self): (source)

Cause keypad to generate control functions.

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

def numericKeypadMode(self): (source)

Cause keypad to generate normal characters.

def selectCharacterSet(self, charSet, which): (source)

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 shiftIn(self): (source)

Activate the G0 character set.

def shiftOut(self): (source)

Activate the G1 character set.

def singleShift2(self): (source)

Shift to the G2 character set for a single character.

def singleShift3(self): (source)

Shift to the G3 character set for a single character.

def selectGraphicRendition(self, *attributes): (source)

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 eraseLine(self): (source)

Erase the entire cursor line.

def eraseToLineEnd(self): (source)

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

def eraseToLineBeginning(self): (source)

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

def eraseDisplay(self): (source)

Erase the entire display.

def eraseToDisplayEnd(self): (source)

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

def eraseToDisplayBeginning(self): (source)

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

def deleteCharacter(self, n=1): (source)

Delete n characters starting at the cursor position.

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

def insertLine(self, n=1): (source)

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 deleteLine(self, n=1): (source)

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 reportCursorPosition(self): (source)

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

def reset(self): (source)

Reset the terminal to its initial state.

def unhandledControlSequence(self, buf): (source)

Called when an unsupported control sequence is received.

ParametersseqThe whole control sequence which could not be interpreted. (type: str)
def __bytes__(self): (source)
Undocumented
API Documentation for Twisted, generated by pydoctor at 2018-07-14 04:53:34.