TerminalDelegate
public protocol TerminalDelegate
The terminal delegate is a protocol that must be implemented by a class
that would provide a user interface for the terminal, and it is used by the
Terminal
to notify of important changes on the underlying terminal
-
showCursor(source:
Default implementation) Invoked to request that the cursor be shown
Default Implementation
Declaration
Swift
func showCursor(source: Terminal)
-
hideCursor(source:
Default implementation) Invoked to request that the cursor be shown
Default Implementation
Declaration
Swift
func hideCursor(source: Terminal)
-
setTerminalTitle(source:
Default implementationtitle: ) This method is invoked when the terminal needs to set the title for the window, a UI toolkit would react by setting the terminal title in the window or any other user visible element.
The default implementation does nothing.
Default Implementation
Declaration
Swift
func setTerminalTitle(source: Terminal, title: String)
-
setTerminalIconTitle(source:
Default implementationtitle: ) This method is invoked when the terminal needs to set the title for the minimized icon, a UI toolkit would react by setting the terminal title in the icon or any other user visible element
The default implementation does nothing.
Default Implementation
Declaration
Swift
func setTerminalIconTitle(source: Terminal, title: String)
-
windowCommand(source:
Default implementationcommand: ) These are various commands that are sent by the client. They are rare, and if you do not know what to return, just return nil, the terminal will return a suitable value.
The response string needs to be suitable for the Xterm CSI Ps ; Ps ; Ps t command see the WindowManipulationCommand enumeration for those that need to return values
The default implementation does nothing.
Default Implementation
Declaration
-
sizeChanged(source:
Default implementation) This method is invoked when the terminal dimensions have changed in response to an escape sequence that triggers a terminal resize, the user interface toolkit should attempt to accomodate the new window size
TODO: This is not wired up
The default implementation does nothing.
Default Implementation
Declaration
Swift
func sizeChanged(source: Terminal)
-
Sends the byte data to the client connected to the terminal (in terminal emulation documentation, this is the “host”)
Declaration
Swift
func send(source: Terminal, data: ArraySlice<UInt8>)
-
scrolled(source:
Default implementationyDisp: ) Callback - the window was scrolled, new yDisplay passed The default implementation does nothing.
Default Implementation
Declaration
Swift
func scrolled(source: Terminal, yDisp: Int)
-
linefeed(source:
Default implementation) Callback a newline was generated The default implementation does nothing.
Default Implementation
Declaration
Swift
func linefeed(source: Terminal)
-
bufferActivated(source:
Default implementation) This method is invoked when the buffer changes from Normal to Alternate, or Alternate to Normal The default implementation does nothing.
Default Implementation
Declaration
Swift
func bufferActivated(source: Terminal)
-
bell(source:
Default implementation) Should raise the bell The default implementation does nothing.
Default Implementation
Declaration
Swift
func bell(source: Terminal)
-
selectionChanged(source:
Default implementation) This is invoked when the selection has changed, or has been turned on. The status is available in
terminal.selection.active
, and the range relative to the buffer is interminal.selection.start
andterminal.selection.end
The default implementation does nothing.
Default Implementation
Declaration
Swift
func selectionChanged(source: Terminal)
-
isProcessTrusted(source:
Default implementation) This method should return
true
if operations that can read the buffer back should be allowed, otherwise, return false. This is useful to run some applications that attempt to checksum the contents of the screen (unit tests)The default implementation returns
true
Default Implementation
Declaration
Swift
func isProcessTrusted(source: Terminal) -> Bool
-
mouseModeChanged(source:
Default implementation) This method is invoked when the
mouseMode
property has changed, and gives the UI a chance to update any tracking capabilities that are required in the toolkit or no longer required to provide the events.The default implementation ignores the mouse change
Default Implementation
Declaration
Swift
func mouseModeChanged(source: Terminal)
-
cursorStyleChanged(source:
Default implementationnewStyle: ) This method is invoked when a request to change the cursor style has been issued by client application.
Default Implementation
Declaration
Swift
func cursorStyleChanged(source: Terminal, newStyle: CursorStyle)
-
hostCurrentDirectoryUpdated(source:
Default implementation) This method is invoked when the client application has issued a command to report its current working directory (this is done with the OSC 7 command). The value can be read by accessing the
hostCurrentDirectory
property.The default implementaiton does nothing.
Default Implementation
Declaration
Swift
func hostCurrentDirectoryUpdated(source: Terminal)
-
colorChanged(source:
Default implementationidx: ) This method is invoked when a color in the 0..255 palette has been redefined, if the front-end keeps a cache or uses indexed rendering, it should update the color with the new values. If the value of idx is nil, this means all the ansi colors changed
Default Implementation
Declaration
Swift
func colorChanged(source: Terminal, idx: Int?)
-
setForegroundColor(source:
Default implementationcolor: ) The view should try to set the foreground color to the provided color
Default Implementation
-
setBackgroundColor(source:
Default implementationcolor: ) The view should try to set the background color to the provided color
Default Implementation
-
getColors(source:
Default implementation) This should return the current foreground and background colors to report.
Default Implementation