The OpenD Programming Language

arsd.terminalemulator

This is an extendible unix terminal emulator and some helper functions to help actually implement one.

You'll have to subclass TerminalEmulator and implement the abstract functions as well as write a drawing function for it.

See minigui_addons/terminal_emulator_widget in arsd repo or nestedterminalemulator.d or main.d in my terminal-emulator repo for how I did it.

Constructors

this
this(int width, int height)

construct

Members

Classes

TerminalEmulator
class TerminalEmulator

An abstract class that does terminal emulation. You'll have to subclass it to make it work.

Functions

cls
void cls()

clear the screen

doNothing
void doNothing()

you can pass this as PtySupport's arguments when you just don't care

sendRawInput
void sendRawInput(ubyte[] datain)

sends raw input data to the terminal as if the application printf()'d it or it echoed or whatever

startChild
void startChild(string program, string[] args)

this is good

startChild
void startChild(string program, string commandLine)

this is good. best to call it with plink.exe so it can talk to unix note that plink asks for the password out of band, so it won't actually work like that. thus specify the password on the command line or better yet, use a private key file e.g. startChild!something("plink.exe", "plink.exe user@server -i key.ppk \"/home/user/terminal-emulator/serverside\"");

writeScrollbackToDelegate
void writeScrollbackToDelegate(void delegate(dchar c) dg)

Writes the text in the scrollback buffer to the given delegate, one character at a time.

writeScrollbackToFile
void writeScrollbackToFile(string filename)

Writes the text in the scrollback buffer to the given file.

Mixin templates

ForwardVirtuals
mixintemplate ForwardVirtuals(alias writer)

Implementation of TerminalEmulator's abstract functions that forward them to output

PtySupport
mixintemplate PtySupport(alias resizeHelper)

You must implement a function called redraw() and initialize the members in your constructor

Structs

CursorPosition
struct CursorPosition

Cursor position, zero based. (0,0) == upper left. (0, 1) == second row, first column.

Variables

nonCharacterDataStore
NonCharacterData nonCharacterDataStore;

iff hasNonCharacterData

Meta

History

Written September/October 2013ish. Moved to arsd 2020-03-26.