IArlecchinoTerminal interface
Namespace: Arlecchino · Assembly: Arlecchino.Core
Everything the framework needs from a console. Replace it with UseTerminal<T>() to drive a test harness or a remote session; SystemTerminal is the real one.
public interface IArlecchinoTerminal
Implemented by SystemTerminal, FakeTerminal
Properties
| Member | Summary |
|---|---|
Height | Height of the window in rows. |
KeyAvailable | Whether IArlecchinoTerminal.ReadKey can return immediately. |
MouseAvailable | Whether IArlecchinoTerminal.ReadMouse can return immediately. Only terminals that deliver the mouse outside the key stream — the Windows console — ever report true; elsewhere mouse reports arrive as escape sequences among the keys. |
Width | Width of the window in cells. |
Methods
| Member | Summary |
|---|---|
CopyToClipboard(string) | Puts text on the clipboard of whatever is showing the terminal, which is the local machine even over a remote session. Terminals may refuse it, and none report back. |
DisableMouse() | Stops reporting mouse events. |
DisablePaste() | Stops the paste markers. |
EnableMouse() | Starts reporting mouse events, if the platform supports it. |
EnablePaste() | Asks the terminal to wrap pasted text in markers, so a paste arrives as one block instead of looking like someone typing very fast. |
EnterFullScreen() | Switches to the alternate screen and hides the cursor. |
GiveBackControlKeys() | Gives Ctrl+C back to the terminal, for the shell the application came from and for whatever program the terminal is lent to while it runs. |
LeaveFullScreen() | Returns to the normal screen and shows the cursor again. |
ReadKey() | Takes the next key, blocking until one arrives. |
ReadMouse() | Takes the next mouse event. Only call it while IArlecchinoTerminal.MouseAvailable is true. |
TakeControlKeys() | Takes Ctrl+C off the terminal, so it arrives as a key press rather than as a signal. The terminal cannot tell it from Ctrl+Shift+C, which types the same character; the application can. |
Unread(KeyPress) | Puts a key back, so the next IArlecchinoTerminal.ReadKey returns it. It is for code that had to read a key to find out it did not want it. |
Write(string) | Writes composed output. A frame arrives as one call. |
Properties in detail
Height
public int Height { get; }
Height of the window in rows.
Type int
KeyAvailable
public bool KeyAvailable { get; }
Whether IArlecchinoTerminal.ReadKey can return immediately.
Type bool
MouseAvailable
public bool MouseAvailable { get; }
Whether IArlecchinoTerminal.ReadMouse can return immediately. Only terminals that deliver the mouse outside the key stream — the Windows console — ever report true; elsewhere mouse reports arrive as escape sequences among the keys.
Type bool
Width
public int Width { get; }
Width of the window in cells.
Type int
Methods in detail
CopyToClipboard(string)
public void CopyToClipboard(string text);
Puts text on the clipboard of whatever is showing the terminal, which is the local machine even over a remote session. Terminals may refuse it, and none report back.
Parameters
| Name | Type | Description |
|---|---|---|
text | string | What to copy. |
DisableMouse()
public void DisableMouse();
Stops reporting mouse events.
DisablePaste()
public void DisablePaste();
Stops the paste markers.
EnableMouse()
public void EnableMouse();
Starts reporting mouse events, if the platform supports it.
EnablePaste()
public void EnablePaste();
Asks the terminal to wrap pasted text in markers, so a paste arrives as one block instead of looking like someone typing very fast.
EnterFullScreen()
public void EnterFullScreen();
Switches to the alternate screen and hides the cursor.
GiveBackControlKeys()
public void GiveBackControlKeys();
Gives Ctrl+C back to the terminal, for the shell the application came from and for whatever program the terminal is lent to while it runs.
LeaveFullScreen()
public void LeaveFullScreen();
Returns to the normal screen and shows the cursor again.
ReadKey()
public KeyPress ReadKey();
Takes the next key, blocking until one arrives.
Returns KeyPress — The key that was pressed.
ReadMouse()
public MouseEvent ReadMouse();
Takes the next mouse event. Only call it while IArlecchinoTerminal.MouseAvailable is true.
Returns MouseEvent — What the mouse did, in frame cells.
TakeControlKeys()
public void TakeControlKeys();
Takes Ctrl+C off the terminal, so it arrives as a key press rather than as a signal. The terminal cannot tell it from Ctrl+Shift+C, which types the same character; the application can.
Unread(KeyPress)
public void Unread(KeyPress key);
Puts a key back, so the next IArlecchinoTerminal.ReadKey returns it. It is for code that had to read a key to find out it did not want it.
Parameters
| Name | Type | Description |
|---|---|---|
key | KeyPress | The key to put back. |
Write(string)
public void Write(string text);
Writes composed output. A frame arrives as one call.
Parameters
| Name | Type | Description |
|---|---|---|
text | string | Text with escape sequences already embedded. |