libghostty
Loading...
Searching...
No Matches
terminal.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <ghostty/vt/types.h>
#include <ghostty/vt/allocator.h>
#include <ghostty/vt/device.h>
#include <ghostty/vt/modes.h>
#include <ghostty/vt/size_report.h>
#include <ghostty/vt/grid_ref.h>
#include <ghostty/vt/kitty_graphics.h>
#include <ghostty/vt/screen.h>
#include <ghostty/vt/point.h>
#include <ghostty/vt/style.h>

Go to the source code of this file.

Data Structures

struct  GhosttyTerminalOptions
union  GhosttyTerminalScrollViewportValue
struct  GhosttyTerminalScrollViewport
struct  GhosttyTerminalScrollbar

Typedefs

typedef void(* GhosttyTerminalBellFn) (GhosttyTerminal terminal, void *userdata)
typedef bool(* GhosttyTerminalColorSchemeFn) (GhosttyTerminal terminal, void *userdata, GhosttyColorScheme *out_scheme)
typedef bool(* GhosttyTerminalDeviceAttributesFn) (GhosttyTerminal terminal, void *userdata, GhosttyDeviceAttributes *out_attrs)
typedef GhosttyString(* GhosttyTerminalEnquiryFn) (GhosttyTerminal terminal, void *userdata)
typedef bool(* GhosttyTerminalSizeFn) (GhosttyTerminal terminal, void *userdata, GhosttySizeReportSize *out_size)
typedef void(* GhosttyTerminalTitleChangedFn) (GhosttyTerminal terminal, void *userdata)
typedef void(* GhosttyTerminalWritePtyFn) (GhosttyTerminal terminal, void *userdata, const uint8_t *data, size_t len)
typedef GhosttyString(* GhosttyTerminalXtversionFn) (GhosttyTerminal terminal, void *userdata)

Enumerations

enum  GhosttyTerminalScrollViewportTag { GHOSTTY_SCROLL_VIEWPORT_TOP , GHOSTTY_SCROLL_VIEWPORT_BOTTOM , GHOSTTY_SCROLL_VIEWPORT_DELTA , GHOSTTY_SCROLL_VIEWPORT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE }
enum  GhosttyTerminalScreen { GHOSTTY_TERMINAL_SCREEN_PRIMARY = 0 , GHOSTTY_TERMINAL_SCREEN_ALTERNATE = 1 , GHOSTTY_TERMINAL_SCREEN_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE }
enum  GhosttyTerminalOption {
  GHOSTTY_TERMINAL_OPT_USERDATA = 0 , GHOSTTY_TERMINAL_OPT_WRITE_PTY = 1 , GHOSTTY_TERMINAL_OPT_BELL = 2 , GHOSTTY_TERMINAL_OPT_ENQUIRY = 3 ,
  GHOSTTY_TERMINAL_OPT_XTVERSION = 4 , GHOSTTY_TERMINAL_OPT_TITLE_CHANGED = 5 , GHOSTTY_TERMINAL_OPT_SIZE = 6 , GHOSTTY_TERMINAL_OPT_COLOR_SCHEME = 7 ,
  GHOSTTY_TERMINAL_OPT_DEVICE_ATTRIBUTES = 8 , GHOSTTY_TERMINAL_OPT_TITLE = 9 , GHOSTTY_TERMINAL_OPT_PWD = 10 , GHOSTTY_TERMINAL_OPT_COLOR_FOREGROUND = 11 ,
  GHOSTTY_TERMINAL_OPT_COLOR_BACKGROUND = 12 , GHOSTTY_TERMINAL_OPT_COLOR_CURSOR = 13 , GHOSTTY_TERMINAL_OPT_COLOR_PALETTE = 14 , GHOSTTY_TERMINAL_OPT_KITTY_IMAGE_STORAGE_LIMIT = 15 ,
  GHOSTTY_TERMINAL_OPT_KITTY_IMAGE_MEDIUM_FILE = 16 , GHOSTTY_TERMINAL_OPT_KITTY_IMAGE_MEDIUM_TEMP_FILE = 17 , GHOSTTY_TERMINAL_OPT_KITTY_IMAGE_MEDIUM_SHARED_MEM = 18 , GHOSTTY_TERMINAL_OPT_APC_MAX_BYTES = 19 ,
  GHOSTTY_TERMINAL_OPT_APC_MAX_BYTES_KITTY = 20 , GHOSTTY_TERMINAL_OPT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE
}
enum  GhosttyTerminalData {
  GHOSTTY_TERMINAL_DATA_INVALID = 0 , GHOSTTY_TERMINAL_DATA_COLS = 1 , GHOSTTY_TERMINAL_DATA_ROWS = 2 , GHOSTTY_TERMINAL_DATA_CURSOR_X = 3 ,
  GHOSTTY_TERMINAL_DATA_CURSOR_Y = 4 , GHOSTTY_TERMINAL_DATA_CURSOR_PENDING_WRAP = 5 , GHOSTTY_TERMINAL_DATA_ACTIVE_SCREEN = 6 , GHOSTTY_TERMINAL_DATA_CURSOR_VISIBLE = 7 ,
  GHOSTTY_TERMINAL_DATA_KITTY_KEYBOARD_FLAGS = 8 , GHOSTTY_TERMINAL_DATA_SCROLLBAR = 9 , GHOSTTY_TERMINAL_DATA_CURSOR_STYLE = 10 , GHOSTTY_TERMINAL_DATA_MOUSE_TRACKING = 11 ,
  GHOSTTY_TERMINAL_DATA_TITLE = 12 , GHOSTTY_TERMINAL_DATA_PWD = 13 , GHOSTTY_TERMINAL_DATA_TOTAL_ROWS = 14 , GHOSTTY_TERMINAL_DATA_SCROLLBACK_ROWS = 15 ,
  GHOSTTY_TERMINAL_DATA_WIDTH_PX = 16 , GHOSTTY_TERMINAL_DATA_HEIGHT_PX = 17 , GHOSTTY_TERMINAL_DATA_COLOR_FOREGROUND = 18 , GHOSTTY_TERMINAL_DATA_COLOR_BACKGROUND = 19 ,
  GHOSTTY_TERMINAL_DATA_COLOR_CURSOR = 20 , GHOSTTY_TERMINAL_DATA_COLOR_PALETTE = 21 , GHOSTTY_TERMINAL_DATA_COLOR_FOREGROUND_DEFAULT = 22 , GHOSTTY_TERMINAL_DATA_COLOR_BACKGROUND_DEFAULT = 23 ,
  GHOSTTY_TERMINAL_DATA_COLOR_CURSOR_DEFAULT = 24 , GHOSTTY_TERMINAL_DATA_COLOR_PALETTE_DEFAULT = 25 , GHOSTTY_TERMINAL_DATA_KITTY_IMAGE_STORAGE_LIMIT = 26 , GHOSTTY_TERMINAL_DATA_KITTY_IMAGE_MEDIUM_FILE = 27 ,
  GHOSTTY_TERMINAL_DATA_KITTY_IMAGE_MEDIUM_TEMP_FILE = 28 , GHOSTTY_TERMINAL_DATA_KITTY_IMAGE_MEDIUM_SHARED_MEM = 29 , GHOSTTY_TERMINAL_DATA_KITTY_GRAPHICS = 30 , GHOSTTY_TERMINAL_DATA_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE
}

Functions

GHOSTTY_API GhosttyResult ghostty_terminal_new (const GhosttyAllocator *allocator, GhosttyTerminal *terminal, GhosttyTerminalOptions options)
GHOSTTY_API void ghostty_terminal_free (GhosttyTerminal terminal)
GHOSTTY_API void ghostty_terminal_reset (GhosttyTerminal terminal)
GHOSTTY_API GhosttyResult ghostty_terminal_resize (GhosttyTerminal terminal, uint16_t cols, uint16_t rows, uint32_t cell_width_px, uint32_t cell_height_px)
GHOSTTY_API GhosttyResult ghostty_terminal_set (GhosttyTerminal terminal, GhosttyTerminalOption option, const void *value)
GHOSTTY_API void ghostty_terminal_vt_write (GhosttyTerminal terminal, const uint8_t *data, size_t len)
GHOSTTY_API void ghostty_terminal_scroll_viewport (GhosttyTerminal terminal, GhosttyTerminalScrollViewport behavior)
GHOSTTY_API GhosttyResult ghostty_terminal_mode_get (GhosttyTerminal terminal, GhosttyMode mode, bool *out_value)
GHOSTTY_API GhosttyResult ghostty_terminal_mode_set (GhosttyTerminal terminal, GhosttyMode mode, bool value)
GHOSTTY_API GhosttyResult ghostty_terminal_get (GhosttyTerminal terminal, GhosttyTerminalData data, void *out)
GHOSTTY_API GhosttyResult ghostty_terminal_get_multi (GhosttyTerminal terminal, size_t count, const GhosttyTerminalData *keys, void **values, size_t *out_written)
GHOSTTY_API GhosttyResult ghostty_terminal_grid_ref (GhosttyTerminal terminal, GhosttyPoint point, GhosttyGridRef *out_ref)
GHOSTTY_API GhosttyResult ghostty_terminal_point_from_grid_ref (GhosttyTerminal terminal, const GhosttyGridRef *ref, GhosttyPointTag tag, GhosttyPointCoordinate *out)

Detailed Description

Complete terminal emulator state and rendering.

Definition in file terminal.h.