arsd.terminalemulator

FIXME: writing a line in color then a line in ordinary does something wrong.

huh if i do underline then change color it undoes the underline

FIXME: make shift+enter send something special to the application and shift+space, etc. identify itself somehow too for client extensions ctrl+space is supposed to send char 0.

ctrl+click on url pattern could open in browser perhaps

FIXME: scroll stuff should be higher level in the implementation. so like scroll Rect, DirectionAndAmount

There should be a redraw thing that is given batches of instructions in here that the other thing just implements.

FIXME: the save stack stuff should do cursor style too

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 nestedterminalemulator.d or main.d for how I did it.

Constructors

this
this(int width, int height)

construct

Members

Aliases

HPCON
alias HPCON = HANDLE

Undocumented in source.

Classes

TerminalEmulator
class TerminalEmulator

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

Enums

MouseButton
enum MouseButton

Undocumented in source.

MouseEventType
enum MouseEventType

Undocumented in source.

TerminalKey
enum TerminalKey

Undocumented in source.

Functions

CreateNamedPipeA
HANDLE CreateNamedPipeA(const(char)* lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)

Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.

GetOverlappedResult
BOOL GetOverlappedResult(HANDLE , OVERLAPPED* , LPDWORD , BOOL )

Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.

InitializeProcThreadAttributeList
BOOL InitializeProcThreadAttributeList(void* , DWORD , DWORD , PSIZE_T )

Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.

PeekNamedPipe
BOOL PeekNamedPipe(HANDLE , LPVOID , DWORD , LPDWORD , LPDWORD , LPDWORD )

Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.

PostMessageA
BOOL PostMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)

Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.

PostThreadMessageA
BOOL PostThreadMessageA(DWORD , UINT , WPARAM , LPARAM )

Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.

RegisterWaitForSingleObject
BOOL RegisterWaitForSingleObject(PHANDLE phNewWaitObject, HANDLE hObject, void* Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags)

Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.

SetHandleInformation
BOOL SetHandleInformation(HANDLE , DWORD , DWORD )

Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.

SetLastError
void SetLastError(DWORD )

Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.

UnregisterWait
BOOL UnregisterWait(HANDLE )

Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.

UpdateProcThreadAttribute
BOOL UpdateProcThreadAttribute(void* , DWORD , DWORD_PTR , PVOID , SIZE_T , PVOID , PSIZE_T )

Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.

addOutput
void addOutput(TerminalCell tc)

Undocumented in source. Be warned that the author may not have intended to support it.

addOutput
void addOutput(ubyte b)

Undocumented in source. Be warned that the author may not have intended to support it.

addOutput
void addOutput(string b)

Undocumented in source. Be warned that the author may not have intended to support it.

addScrollbackLine
void addScrollbackLine(TerminalCell[] line)

Undocumented in source. Be warned that the author may not have intended to support it.

addScrollbackOutput
void addScrollbackOutput(TerminalCell tc)

Undocumented in source. Be warned that the author may not have intended to support it.

addScrollbackOutput
void addScrollbackOutput(dchar ch)

Undocumented in source. Be warned that the author may not have intended to support it.

allMouseTrackingOff
void allMouseTrackingOff()

Undocumented in source. Be warned that the author may not have intended to support it.

attributes
TextAttributes attributes()

Undocumented in source. Be warned that the author may not have intended to support it.

ch
dchar ch()

Undocumented in source. Be warned that the author may not have intended to support it.

ch
void ch(dchar c)

Undocumented in source. Be warned that the author may not have intended to support it.

childCallback
void childCallback(void* tidp, bool )

Undocumented in source. Be warned that the author may not have intended to support it.

clearScrollbackHistory
void clearScrollbackHistory()

Undocumented in source. Be warned that the author may not have intended to support it.

clearSelection
void clearSelection()

Undocumented in source. Be warned that the author may not have intended to support it.

cls
void cls()

clear the screen

doNothing
void doNothing()

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

drawScrollback
void drawScrollback(bool useAltScreen)

Undocumented in source. Be warned that the author may not have intended to support it.

encodeSmallTextImage
string encodeSmallTextImage(IndexedImage ii)

Undocumented in source. Be warned that the author may not have intended to support it.

endScrollback
bool endScrollback()

Undocumented in source. Be warned that the author may not have intended to support it.

getPlainText
string getPlainText(int offsetStart, int offsetEnd)

Undocumented in source. Be warned that the author may not have intended to support it.

hasNonCharacterData
bool hasNonCharacterData()

Undocumented in source. Be warned that the author may not have intended to support it.

hasNonCharacterData
void hasNonCharacterData(bool t)

Undocumented in source. Be warned that the author may not have intended to support it.

hyperlinkBit
bool hyperlinkBit()

Undocumented in source. Be warned that the author may not have intended to support it.

hyperlinkBit
void hyperlinkBit(bool t)

Undocumented in source. Be warned that the author may not have intended to support it.

hyperlinkStatus
ubyte hyperlinkStatus()

Undocumented in source. Be warned that the author may not have intended to support it.

hyperlinkStatus
void hyperlinkStatus(ubyte t)

Undocumented in source. Be warned that the author may not have intended to support it.

invalidated
bool invalidated()

Undocumented in source. Be warned that the author may not have intended to support it.

invalidated
void invalidated(bool t)

Undocumented in source. Be warned that the author may not have intended to support it.

isWordSeparator
bool isWordSeparator(dchar ch)

Undocumented in source. Be warned that the author may not have intended to support it.

makeSelectionOffsetsSane
void makeSelectionOffsetsSane(int offsetStart, int offsetEnd)

Undocumented in source. Be warned that the author may not have intended to support it.

maxScrollbackLength
int maxScrollbackLength()

Undocumented in source. Be warned that the author may not have intended to support it.

mouseMotionTracking
bool mouseMotionTracking()

Undocumented in source. Be warned that the author may not have intended to support it.

mouseMotionTracking
void mouseMotionTracking(bool b)

Undocumented in source. Be warned that the author may not have intended to support it.

moveCursor
void moveCursor(int x, int y)

Undocumented in source. Be warned that the author may not have intended to support it.

newLine
void newLine(bool commitScrollback)

Undocumented in source. Be warned that the author may not have intended to support it.

nonCharacterData
NonCharacterData nonCharacterData()

Undocumented in source. Be warned that the author may not have intended to support it.

nonCharacterData
void nonCharacterData(NonCharacterData c)

Undocumented in source. Be warned that the author may not have intended to support it.

notifyScrollbackAdded
void notifyScrollbackAdded()

Undocumented in source. Be warned that the author may not have intended to support it.

notifyScrollbarPosition
void notifyScrollbarPosition(int x, int y)

Undocumented in source. Be warned that the author may not have intended to support it.

notifyScrollbarRelevant
void notifyScrollbarRelevant(bool isRelevantHorizontally, bool isRelevantVertically)

Undocumented in source. Be warned that the author may not have intended to support it.

readSmallTextImage
IndexedImage readSmallTextImage(const(char)[] arg)

Undocumented in source. Be warned that the author may not have intended to support it.

resizeTerminal
void resizeTerminal(int w, int h)

Undocumented in source. Be warned that the author may not have intended to support it.

scrollDown
void scrollDown(int count)

Undocumented in source. Be warned that the author may not have intended to support it.

scrollUp
void scrollUp(int count)

Undocumented in source. Be warned that the author may not have intended to support it.

scrollback
void scrollback(int delta, int deltaX)

Undocumented in source. Be warned that the author may not have intended to support it.

scrollbackLength
int scrollbackLength()

Undocumented in source. Be warned that the author may not have intended to support it.

scrollbackTo
void scrollbackTo(int x, int y)

Undocumented in source. Be warned that the author may not have intended to support it.

scrollbackWidth
int scrollbackWidth()

Undocumented in source. Be warned that the author may not have intended to support it.

selected
bool selected()

Undocumented in source. Be warned that the author may not have intended to support it.

selected
void selected(bool t)

Undocumented in source. Be warned that the author may not have intended to support it.

sendRawInput
void sendRawInput(ubyte[] datain)

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

sliceTrailingWhitespace
TerminalEmulator.TerminalCell[] sliceTrailingWhitespace(TerminalEmulator.TerminalCell[] t)

Undocumented in source. Be warned that the author may not have intended to support it.

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\"");

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

this is good

startChild
void startChild(string host, short port, string username, string keyFile, string expectedFingerprint)

Undocumented in source. Be warned that the author may not have intended to support it.

toggleScrollLock
void toggleScrollLock()

Undocumented in source. Be warned that the author may not have intended to support it.

toggleScrollbackWrap
void toggleScrollbackWrap()

Undocumented in source. Be warned that the author may not have intended to support it.

tryEsc
void tryEsc(ubyte[] esc)

Undocumented in source. Be warned that the author may not have intended to support it.

unknownEscapeSequence
void unknownEscapeSequence(char[] esc)

Undocumented in source. Be warned that the author may not have intended to support it.

writeScrollbackToFile
void writeScrollbackToFile(string filename)

Undocumented in source. Be warned that the author may not have intended to support it.

xtermPalette
immutable(Color)[] xtermPalette()

Undocumented in source. Be warned that the author may not have intended to support it.

Interfaces

NonCharacterData
interface NonCharacterData

Undocumented in source.

Manifest constants

EXTENDED_STARTUPINFO_PRESENT
enum EXTENDED_STARTUPINFO_PRESENT;

Undocumented in source.

PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE
enum PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE;

Undocumented in source.

extensionMagicIdentifier
enum extensionMagicIdentifier;

Undocumented in source.

terminalIdCode
enum terminalIdCode;

Undocumented in source.

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

SdpyDraw
mixintemplate SdpyDraw()

Undocumented in source.

SdpyImageSupport
mixintemplate SdpyImageSupport()

Undocumented in source.

Properties

ASS
Helper ASS [@property getter]

Undocumented in source. Be warned that the author may not have intended to support it.

cursorX
void cursorX [@property getter]

Undocumented in source. Be warned that the author may not have intended to support it.

cursorX
int cursorX [@property getter]

Undocumented in source. Be warned that the author may not have intended to support it.

cursorY
void cursorY [@property getter]

Undocumented in source. Be warned that the author may not have intended to support it.

cursorY
int cursorY [@property getter]

Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

actuallyRead
uint actuallyRead(void* ptr)

Undocumented in source. Be warned that the author may not have intended to support it.

forkpty
int forkpty(int* master, void* name, void* termp, void* winp)

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

initPipeHack
void initPipeHack(void* ptr)

Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

childDead
bool childDead;

Undocumented in source.

helperBuffer
ubyte[] helperBuffer;

Undocumented in source.

helperThread
HANDLE helperThread;

Undocumented in source.

inputEvent
HANDLE inputEvent;

Undocumented in source.

lineDrawingCharacterSet
dchar[dchar] lineDrawingCharacterSet;

Undocumented in source.

magicEvent
HANDLE magicEvent;

Undocumented in source.

waitHandle
HANDLE waitHandle;

Undocumented in source.

Structs

BrokenUpImage
struct BrokenUpImage

Undocumented in source.

CursorPosition
struct CursorPosition

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

CustomGlyph
struct CustomGlyph

Undocumented in source.

Helper
struct Helper

Undocumented in source.

Helper2
struct Helper2

Undocumented in source.

STARTUPINFOEXA
struct STARTUPINFOEXA

Undocumented in source.

ScopeBuffer
struct ScopeBuffer(T, size_t maxSize, bool allowGrowth = false)

Undocumented in source.

ScrollbackBuffer
struct ScrollbackBuffer

Undocumented in source.

Variables

ClosePseudoConsole
void function(HPCON) ClosePseudoConsole;

Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.

CreatePseudoConsole
HRESULT function(COORD, HANDLE, HANDLE, DWORD, HPCON*) CreatePseudoConsole;

Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.

ResizePseudoConsole
HRESULT function(HPCON, COORD) ResizePseudoConsole;

Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.

alternateScreen
TerminalCell[] alternateScreen;

Undocumented in source.

alternateScreenActive
bool alternateScreenActive;

Undocumented in source.

applicationCursorKeys
bool applicationCursorKeys;

Undocumented in source.

attentionDemanded
bool attentionDemanded;

Undocumented in source.

attrStore
ubyte attrStore;

Undocumented in source.

bracketedHyperlinkMode
bool bracketedHyperlinkMode;

Undocumented in source.

bracketedPasteMode
bool bracketedPasteMode;

Undocumented in source.

characterSet
immutable(dchar[dchar])* characterSet;

Undocumented in source.

cueScrollback
bool cueScrollback;

Undocumented in source.

currentAttributes
TextAttributes currentAttributes;

Undocumented in source.

currentScrollback
int currentScrollback;

Undocumented in source.

currentScrollbackLine
TerminalCell[] currentScrollbackLine;

Undocumented in source.

currentScrollbackX
int currentScrollbackX;

Undocumented in source.

currentUtf8Shift
int currentUtf8Shift;

Undocumented in source.

cursorColor
Color cursorColor;

Undocumented in source.

cursorPosition
CursorPosition cursorPosition;

Undocumented in source.

cursorShowing
bool cursorShowing;

Undocumented in source.

cursorStyle
CursorStyle cursorStyle;

Undocumented in source.

esc
ScopeBuffer!(ubyte, 1024, true) esc;

Undocumented in source.

extensionData
string extensionData;

Undocumented in source.

hyperlinkActive
bool hyperlinkActive;

Undocumented in source.

hyperlinkFlipper
bool hyperlinkFlipper;

Undocumented in source.

hyperlinkNumber
int hyperlinkNumber;

Undocumented in source.

iconStack
IndexedImage[] iconStack;

Undocumented in source.

iconTitle
string iconTitle;

Undocumented in source.

insertMode
bool insertMode;

Undocumented in source.

invalidateAll
bool invalidateAll;

Undocumented in source.

mouseButtonMotionTracking
bool mouseButtonMotionTracking;

Undocumented in source.

mouseButtonReleaseTracking
bool mouseButtonReleaseTracking;

Undocumented in source.

mouseButtonTracking
bool mouseButtonTracking;

Undocumented in source.

newLineOnNext
bool newLineOnNext;

Undocumented in source.

nonCharacterDataStore
NonCharacterData nonCharacterDataStore;

Undocumented in source.

normalScreen
TerminalCell[] normalScreen;

Undocumented in source.

readingEsc
bool readingEsc;

Undocumented in source.

readingExtensionData
int readingExtensionData;

Undocumented in source.

reverseVideo
bool reverseVideo;

Undocumented in source.

savedCursors
CursorPosition[] savedCursors;

Undocumented in source.

screenHeight
int screenHeight;

Undocumented in source.

screenWidth
int screenWidth;

Undocumented in source.

scrollZoneBottom
int scrollZoneBottom;

Undocumented in source.

scrollZoneTop
int scrollZoneTop;

Undocumented in source.

scrollbackBuffer
ScrollbackBuffer scrollbackBuffer;

Undocumented in source.

scrollingBack
bool scrollingBack;

Undocumented in source.

scrollingEnabled
bool scrollingEnabled;

Undocumented in source.

selectiveMouseTracking
bool selectiveMouseTracking;

Undocumented in source.

titleStack
string[] titleStack;

Undocumented in source.

utf8BytesRemaining
int utf8BytesRemaining;

Undocumented in source.

utf8Sequence
dchar utf8Sequence;

Undocumented in source.

utf8SequenceBuffer
ubyte[6] utf8SequenceBuffer;

Undocumented in source.

utf8SequenceBufferPosition
int utf8SequenceBufferPosition;

Undocumented in source.

windowIcon
IndexedImage windowIcon;

Undocumented in source.

windowTitle
string windowTitle;

Undocumented in source.

wraparoundMode
bool wraparoundMode;

Undocumented in source.

Meta