mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
@ -116,7 +116,7 @@ it may have encountered. Ghostty currently ignores errors and treats it
|
||||
as if the configuration had not been set, so this is the best place to look
|
||||
if something isn't working.
|
||||
|
||||
Eventually, we'll have a better mecanism for showing errors to the user.
|
||||
Eventually, we'll have a better mechanism for showing errors to the user.
|
||||
|
||||
### Shell Integration
|
||||
|
||||
@ -205,7 +205,7 @@ uses a CPU renderer if ligatures are enabled). We can maintain roughly
|
||||
usually rendering much lower due to little screen changes.
|
||||
|
||||
For IO, we have a dedicated IO thread that maintains very little jitter
|
||||
under heavy IO load (i.e. `cat <big file>.txt`). On bechmarks for IO,
|
||||
under heavy IO load (i.e. `cat <big file>.txt`). On benchmarks for IO,
|
||||
we're usually top of the class by a large margin over popular terminal
|
||||
emulators. For example, reading a dump of plain text is 4x faster compared
|
||||
to iTerm and Kitty, and 2x faster than Terminal.app. Alacritty is very
|
||||
|
@ -228,7 +228,7 @@ pub fn build(b: *std.Build) !void {
|
||||
try exe.step.addError(
|
||||
"\x1b[" ++ color_map.get("yellow").? ++
|
||||
"\x1b[" ++ color_map.get("d").? ++
|
||||
\\Detected building on and for NixOS outside of the Nix shell enviornment.
|
||||
\\Detected building on and for NixOS outside of the Nix shell environment.
|
||||
\\
|
||||
\\The resulting ghostty binary will likely fail on launch because it is
|
||||
\\unable to dynamically load the windowing libs (X11, Wayland, etc.).
|
||||
@ -633,7 +633,7 @@ fn addDeps(
|
||||
// Wasm we do manually since it is such a different build.
|
||||
if (step.target.getCpuArch() == .wasm32) {
|
||||
// We link this package but its a no-op since Tracy
|
||||
// never actualy WORKS with wasm.
|
||||
// never actually WORKS with wasm.
|
||||
step.addModule("tracy", tracylib.module(b));
|
||||
step.addModule("utf8proc", utf8proc.module(b));
|
||||
step.addModule("zig-js", js.module(b));
|
||||
|
@ -13,7 +13,7 @@ Rings a "bell" to alert the operator to some condition.
|
||||
|
||||
## TODO
|
||||
|
||||
* Add a configurable visuable bell -- common in most terminal emulators --
|
||||
* Add a configurable visual bell -- common in most terminal emulators --
|
||||
to flash the border.
|
||||
* Mark the window as requesting attention, most operating systems support
|
||||
this. For example, Windows windows will flash in the toolbar.
|
||||
|
@ -12,7 +12,7 @@ TODO: Details about how this interacts with soft wrapping.
|
||||
## Implementation Details
|
||||
|
||||
* ghostty implements this naively as `cursor.x -|= 1` (`-|=` being a
|
||||
saturating substraction).
|
||||
saturating subtraction).
|
||||
|
||||
## TODO
|
||||
|
||||
|
@ -5,4 +5,4 @@
|
||||
| Text | `ESC H` |
|
||||
| Hex | `0x18 0x48` |
|
||||
|
||||
Mark the current cursor colum as a tab stop.
|
||||
Mark the current cursor column as a tab stop.
|
||||
|
@ -18,7 +18,7 @@ struct PrimaryView: View {
|
||||
// This handles non-native fullscreen
|
||||
@State private var fullScreen = FullScreenHandler()
|
||||
|
||||
// This seems like a crutch after switchign from SwiftUI to AppKit lifecycle.
|
||||
// This seems like a crutch after switching from SwiftUI to AppKit lifecycle.
|
||||
@FocusState private var focused: Bool
|
||||
|
||||
@FocusedValue(\.ghosttySurfaceView) private var focusedSurface
|
||||
|
@ -1,4 +1,4 @@
|
||||
# TODO(mitchellh): This currenly doesn't fully work. It generates a binary
|
||||
# TODO(mitchellh): This currently doesn't fully work. It generates a binary
|
||||
# that smashes the stack on run. I'm not sure why.
|
||||
{ stdenv
|
||||
, lib
|
||||
|
@ -73,7 +73,7 @@ pub const Pattern = opaque {
|
||||
|
||||
/// Move to the next object, returns true if there is another
|
||||
/// object and false otherwise. If this is the first call, this
|
||||
/// will be teh first object.
|
||||
/// will be the first object.
|
||||
pub fn next(self: *ObjectIterator) bool {
|
||||
// Null means our first iterator
|
||||
if (self.iter == null) {
|
||||
|
@ -63,7 +63,7 @@ pub const Version = struct {
|
||||
patch: i32,
|
||||
|
||||
/// Convert the version to a string. The buffer should be able to
|
||||
/// accomodate the size, recommended to be at least 8 chars wide.
|
||||
/// accommodate the size, recommended to be at least 8 chars wide.
|
||||
/// The returned slice will be a slice of buf that contains the full
|
||||
/// version string.
|
||||
pub fn toString(self: Version, buf: []u8) ![]const u8 {
|
||||
|
@ -286,7 +286,7 @@ pub fn errorToInt(err: Error) c_int {
|
||||
};
|
||||
}
|
||||
|
||||
test "error convertion" {
|
||||
test "error conversion" {
|
||||
const expectError = @import("std").testing.expectError;
|
||||
|
||||
try intToError(c.FT_Err_Ok);
|
||||
|
@ -188,7 +188,7 @@ const Impl = struct {
|
||||
}
|
||||
|
||||
/// Mark the boundary of a frame. Good for continuous frames. For
|
||||
/// discontinous frames, use frame() and defer end().
|
||||
/// discontinuous frames, use frame() and defer end().
|
||||
pub inline fn frameMark() void {
|
||||
c.___tracy_emit_frame_mark(null);
|
||||
}
|
||||
|
@ -901,7 +901,7 @@ pub fn charCallback(self: *Surface, codepoint: u21) !void {
|
||||
self.renderer_state.mutex.lock();
|
||||
defer self.renderer_state.mutex.unlock();
|
||||
|
||||
// Clear the selction if we have one.
|
||||
// Clear the selection if we have one.
|
||||
if (self.io.terminal.screen.selection != null) {
|
||||
self.io.terminal.screen.selection = null;
|
||||
try self.queueRender();
|
||||
@ -1141,7 +1141,7 @@ pub fn scrollCallback(
|
||||
// Add our previously saved pending amount to the offset to get the
|
||||
// new offset value.
|
||||
//
|
||||
// NOTE: we currently mutiply by -1 because macOS sends the opposite
|
||||
// NOTE: we currently multiply by -1 because macOS sends the opposite
|
||||
// of what we expect. This is jank we should audit our sign usage and
|
||||
// carefully document what we expect so this can work cross platform.
|
||||
// Right now this isn't important because macOS is the only high-precision
|
||||
@ -1653,7 +1653,7 @@ pub fn cursorPosCallback(
|
||||
// If the cursor isn't clicked currently, it doesn't matter
|
||||
if (self.mouse.click_state[@intFromEnum(input.MouseButton.left)] != .press) return;
|
||||
|
||||
// All roads lead to requiring a re-render at this pont.
|
||||
// All roads lead to requiring a re-render at this point.
|
||||
try self.queueRender();
|
||||
|
||||
// If our y is negative, we're above the window. In this case, we scroll
|
||||
@ -1756,7 +1756,7 @@ fn dragLeftClickSingle(
|
||||
if (reset) self.io.terminal.screen.selection = null;
|
||||
}
|
||||
|
||||
// Our logic for determing if the starting cell is selected:
|
||||
// Our logic for determining if the starting cell is selected:
|
||||
//
|
||||
// - The "xboundary" is 60% the width of a cell from the left. We choose
|
||||
// 60% somewhat arbitrarily based on feeling.
|
||||
@ -1918,7 +1918,7 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !void
|
||||
.cursor_key => |ck| {
|
||||
// We send a different sequence depending on if we're
|
||||
// in cursor keys mode. We're in "normal" mode if cursor
|
||||
// keys mdoe is NOT set.
|
||||
// keys mode is NOT set.
|
||||
const normal = normal: {
|
||||
self.renderer_state.mutex.lock();
|
||||
defer self.renderer_state.mutex.unlock();
|
||||
|
@ -275,7 +275,7 @@ pub const Surface = struct {
|
||||
}
|
||||
|
||||
pub fn updateSize(self: *Surface, width: u32, height: u32) void {
|
||||
// Runtimes sometimes generate superflous resize events even
|
||||
// Runtimes sometimes generate superfluous resize events even
|
||||
// if the size did not actually change (SwiftUI). We check
|
||||
// that the size actually changed from what we last recorded
|
||||
// since resizes are expensive.
|
||||
@ -470,7 +470,7 @@ pub const CAPI = struct {
|
||||
return surface.app;
|
||||
}
|
||||
|
||||
/// Returns ture if the surface has transparency set.
|
||||
/// Returns true if the surface has transparency set.
|
||||
export fn ghostty_surface_transparent(surface: *Surface) bool {
|
||||
return surface.app.config.@"background-opacity" < 1.0;
|
||||
}
|
||||
|
@ -948,7 +948,7 @@ pub const Surface = struct {
|
||||
};
|
||||
}
|
||||
|
||||
/// render singal
|
||||
/// render signal
|
||||
fn gtkRender(area: *c.GtkGLArea, ctx: *c.GdkGLContext, ud: ?*anyopaque) callconv(.C) c.gboolean {
|
||||
_ = area;
|
||||
_ = ctx;
|
||||
@ -962,7 +962,7 @@ pub const Surface = struct {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/// render singal
|
||||
/// render signal
|
||||
fn gtkResize(area: *c.GtkGLArea, width: c.gint, height: c.gint, ud: ?*anyopaque) callconv(.C) void {
|
||||
const self = userdataSelf(ud.?);
|
||||
|
||||
|
@ -43,7 +43,7 @@ pub const Artifact = enum {
|
||||
/// Embeddable library
|
||||
lib,
|
||||
|
||||
/// The WASM-targetted module.
|
||||
/// The WASM-targeted module.
|
||||
wasm_module,
|
||||
|
||||
pub fn detect() Artifact {
|
||||
|
@ -381,7 +381,7 @@ test "parseIntoField: struct with parse func" {
|
||||
try testing.expectEqual(@as([]const u8, "HELLO!"), data.a.v);
|
||||
}
|
||||
|
||||
/// Returns an interator (implements "next") that reads CLI args by line.
|
||||
/// Returns an iterator (implements "next") that reads CLI args by line.
|
||||
/// Each CLI arg is expected to be a single line. This is used to implement
|
||||
/// configuration files.
|
||||
pub fn LineIterator(comptime ReaderType: type) type {
|
||||
|
@ -29,7 +29,7 @@ pub const Config = struct {
|
||||
/// a single value (yet).
|
||||
///
|
||||
/// The font feature will apply to all fonts rendered by Ghostty. A
|
||||
/// future enhancement will allow targetting specific faces.
|
||||
/// future enhancement will allow targeting specific faces.
|
||||
///
|
||||
/// A valid value is the name of a feature. Prefix the feature with a
|
||||
/// "-" to explicitly disable it. Example: "ss20" or "-ss20".
|
||||
@ -120,7 +120,7 @@ pub const Config = struct {
|
||||
/// "ctrl+a", "ctrl+shift+b", "up". Some notes:
|
||||
///
|
||||
/// - modifiers cannot repeat, "ctrl+ctrl+a" is invalid.
|
||||
/// - modifers and key scan be in any order, "shift+a+ctrl" is weird,
|
||||
/// - modifiers and key scan be in any order, "shift+a+ctrl" is weird,
|
||||
/// but valid.
|
||||
/// - only a single key input is allowed, "ctrl+a+b" is invalid.
|
||||
///
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! A font group is a a set of multiple font faces of potentially different
|
||||
//! styles that are used together to find glyphs. They usually share sizing
|
||||
//! properties so that they can be used interchangably with each other in cases
|
||||
//! properties so that they can be used interchangeably with each other in cases
|
||||
//! a codepoint doesn't map cleanly. For example, if a user requests a bold
|
||||
//! char and it doesn't exist we can fallback to a regular non-bold char so
|
||||
//! we show SOMETHING.
|
||||
|
@ -377,7 +377,7 @@ pub const Face = struct {
|
||||
// represent the amount under the baseline. We add this to our real
|
||||
// baseline to get the actual value from the bottom (+y is up).
|
||||
// The final underline position is +y from the TOP (confusing)
|
||||
// so we have to substract from the cell height.
|
||||
// so we have to subtract from the cell height.
|
||||
const underline_position = cell_height -
|
||||
(cell_baseline + @ceil(@as(f32, @floatCast(ct_font.getUnderlinePosition())))) +
|
||||
1;
|
||||
|
@ -122,7 +122,7 @@ pub const Face = struct {
|
||||
const p: font.Presentation = if (cp <= 255) .text else p: {
|
||||
break :p self.glyphPresentation(cp) catch {
|
||||
// In this case, we assume we are unable to render
|
||||
// this glyph and therefore jus say we don't support it.
|
||||
// this glyph and therefore just say we don't support it.
|
||||
return null;
|
||||
};
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ pub const options: struct {
|
||||
} = .{
|
||||
// TODO: we need to modify the build config for wasm builds. the issue
|
||||
// is we're sharing the build config options between all exes in build.zig.
|
||||
// We need to construt it per target.
|
||||
// We need to construct it per target.
|
||||
.backend = if (builtin.target.isWasm()) .web_canvas else build_config.font_backend,
|
||||
};
|
||||
|
||||
|
@ -46,7 +46,7 @@ pub const RunIterator = struct {
|
||||
// We're over at the max
|
||||
if (self.i >= max) return null;
|
||||
|
||||
// Track the font for our curent run
|
||||
// Track the font for our current run
|
||||
var current_font: font.Group.FontIndex = .{};
|
||||
|
||||
// Allow the hook to prepare
|
||||
|
@ -31,7 +31,7 @@ height: u32,
|
||||
/// want to do any DPI scaling, it is expected to be done earlier.
|
||||
thickness: u32,
|
||||
|
||||
/// The position fo the underline.
|
||||
/// The position of the underline.
|
||||
underline_position: u32 = 0,
|
||||
|
||||
/// Returns true if the codepoint exists in our sprite font.
|
||||
|
@ -37,7 +37,7 @@ pub const Action = enum(c_int) {
|
||||
|
||||
/// The set of keys that can map to keybindings. These have no fixed enum
|
||||
/// values because we map platform-specific keys to this set. Note that
|
||||
/// this only needs to accomodate what maps to a key. If a key is not bound
|
||||
/// this only needs to accommodate what maps to a key. If a key is not bound
|
||||
/// to anything and the key can be mapped to a printable character, then that
|
||||
/// unicode character is sent directly to the pty.
|
||||
///
|
||||
|
@ -50,7 +50,7 @@ pub const MouseButton = enum(c_int) {
|
||||
|
||||
/// The "momentum" of a mouse scroll event. This matches the macOS events
|
||||
/// because it is the only reliable source right now of momentum events.
|
||||
/// This is used to handle "intertial scrolling" (i.e. flicking).
|
||||
/// This is used to handle "inertial scrolling" (i.e. flicking).
|
||||
///
|
||||
/// https://developer.apple.com/documentation/appkit/nseventphase
|
||||
pub const MouseMomentum = enum(u3) {
|
||||
@ -71,7 +71,7 @@ pub const ScrollMods = packed struct(u8) {
|
||||
precision: bool = false,
|
||||
|
||||
/// The momentum phase (if available, supported) of the scroll event.
|
||||
/// This is used to handle "intertial scrolling" (i.e. flicking).
|
||||
/// This is used to handle "inertial scrolling" (i.e. flicking).
|
||||
momentum: MouseMomentum = .none,
|
||||
|
||||
_padding: u4 = 0,
|
||||
|
@ -2,7 +2,7 @@ const std = @import("std");
|
||||
const assert = std.debug.assert;
|
||||
const Allocator = std.mem.Allocator;
|
||||
|
||||
/// Create a HashMap for a key type that can be autoamtically hashed.
|
||||
/// Create a HashMap for a key type that can be automatically hashed.
|
||||
/// If you want finer-grained control, use HashMap directly.
|
||||
pub fn AutoHashMap(comptime K: type, comptime V: type) type {
|
||||
return HashMap(
|
||||
|
@ -129,7 +129,7 @@ pub const GlobalState = struct {
|
||||
errdefer self.deinit();
|
||||
|
||||
self.gpa = gpa: {
|
||||
// Use the libc allocator if it is available beacuse it is WAY
|
||||
// Use the libc allocator if it is available because it is WAY
|
||||
// faster than GPA. We only do this in release modes so that we
|
||||
// can get easy memory leak detection in debug modes.
|
||||
if (builtin.link_libc) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! OpenGL bindings.
|
||||
//!
|
||||
//! These are pupose-built for usage within this program. While they closely
|
||||
//! These are purpose-built for usage within this program. While they closely
|
||||
//! align with the OpenGL C APIs, they aren't meant to be general purpose,
|
||||
//! they aren't meant to have 100% API coverage, and they aren't meant to
|
||||
//! be hyper-performant.
|
||||
|
@ -134,7 +134,7 @@ pub const Padding = struct {
|
||||
};
|
||||
}
|
||||
|
||||
/// Add another padding to ths one
|
||||
/// Add another padding to this one
|
||||
pub fn add(self: Padding, other: Padding) Padding {
|
||||
return .{
|
||||
.top = self.top + other.top,
|
||||
|
@ -27,7 +27,7 @@
|
||||
# Ghostty in all shells should add the following lines to their .zshrc:
|
||||
#
|
||||
# if [[ -n $GHOSTTY_RESOURCES_DIR ]]; then
|
||||
# autoload -Uz -- "$GHOSTTY_RESOURCSE_DIR"/shell-integration/zsh/ghostty-integration
|
||||
# autoload -Uz -- "$GHOSTTY_RESOURCES_DIR"/shell-integration/zsh/ghostty-integration
|
||||
# ghostty-integration
|
||||
# unfunction ghostty-integration
|
||||
# fi
|
||||
|
@ -212,8 +212,8 @@ pub fn init() Parser {
|
||||
return .{};
|
||||
}
|
||||
|
||||
/// Next consums the next character c and returns the actions to execute.
|
||||
/// Up to 3 actions may need to be exected -- in order -- representing
|
||||
/// Next consumes the next character c and returns the actions to execute.
|
||||
/// Up to 3 actions may need to be executed -- in order -- representing
|
||||
/// the state exit, transition, and entry actions.
|
||||
pub fn next(self: *Parser, c: u8) [3]?Action {
|
||||
const tracy = trace(@src());
|
||||
|
@ -207,7 +207,7 @@ pub const Cell = struct {
|
||||
/// two cells. The following cell ALWAYS is a space.
|
||||
wide: bool = false,
|
||||
|
||||
/// Notes that this only exists to be blank for a preceeding
|
||||
/// Notes that this only exists to be blank for a preceding
|
||||
/// wide character (tail) or following (head).
|
||||
wide_spacer_tail: bool = false,
|
||||
wide_spacer_head: bool = false,
|
||||
@ -863,7 +863,7 @@ pub fn clone(self: *Screen, alloc: Allocator, top: RowIndex, bottom: RowIndex) !
|
||||
|
||||
// We also figure out the "max y" we can have based on the number
|
||||
// of rows written. This is used to prevent from reading out of the
|
||||
// circular buffer where we might ahve no initialized data yet.
|
||||
// circular buffer where we might have no initialized data yet.
|
||||
const max_y = max_y: {
|
||||
const rows_written = self.rowsWritten();
|
||||
const index = RowIndex{ .active = @min(rows_written -| 1, self.rows - 1) };
|
||||
@ -1033,7 +1033,7 @@ pub fn scrollRegionUp(self: *Screen, top: RowIndex, bottom: RowIndex, count: usi
|
||||
// The total amount we're going to copy
|
||||
const total_copy = (height - count) * (self.cols + 1);
|
||||
|
||||
// Fast-path is that we have a contigous buffer in our circular buffer.
|
||||
// Fast-path is that we have a contiguous buffer in our circular buffer.
|
||||
// In this case we can do some memmoves.
|
||||
if (slices[1].len == 0) {
|
||||
const buf = slices[0];
|
||||
@ -1996,7 +1996,7 @@ pub fn resizeWithoutReflow(self: *Screen, rows: usize, cols: usize) !void {
|
||||
|
||||
// Convert our cursor to screen coordinates so we can preserve it.
|
||||
// The cursor is normally in active coordinates, but by converting to
|
||||
// screen we can accomodate keeping it on the same place if we retain
|
||||
// screen we can accommodate keeping it on the same place if we retain
|
||||
// the same scrollback.
|
||||
const old_cursor_y_screen = RowIndexTag.active.index(old.cursor.y).toScreen(&old).screen;
|
||||
self.cursor.x = @min(old.cursor.x, self.cols - 1);
|
||||
|
@ -19,7 +19,7 @@ const fastmem = @import("../fastmem.zig");
|
||||
const Unit = u8;
|
||||
const unit_bits = @bitSizeOf(Unit);
|
||||
|
||||
/// The number of columsn we preallocate for. This is kind of high which
|
||||
/// The number of columns we preallocate for. This is kind of high which
|
||||
/// costs us some memory, but this is more columns than my 6k monitor at
|
||||
/// 12-point font size, so this should prevent allocation in almost all
|
||||
/// real world scenarios for the price of wasting at most
|
||||
|
@ -1520,7 +1520,7 @@ pub fn markSemanticPrompt(self: *Terminal, p: SemanticPrompt) void {
|
||||
}
|
||||
|
||||
/// Returns true if the cursor is currently at a prompt. Another way to look
|
||||
/// at this is it returns false if the shell is currently outputing something.
|
||||
/// at this is it returns false if the shell is currently outputting something.
|
||||
/// This requires shell integration (semantic prompt integration).
|
||||
///
|
||||
/// If the shell integration doesn't exist, this will always return false.
|
||||
|
@ -6,7 +6,7 @@
|
||||
//! But has some modifications:
|
||||
//!
|
||||
//! * utf8 state introduced to detect UTF8-encoded sequences. The
|
||||
//! actual handling back OUT of the utf8 state is done manualy in the
|
||||
//! actual handling back OUT of the utf8 state is done manually in the
|
||||
//! parser.
|
||||
//!
|
||||
//! * csi_param accepts the colon character (':') since the SGR command
|
||||
|
@ -458,7 +458,7 @@ pub fn Stream(comptime Handler: type) type {
|
||||
);
|
||||
},
|
||||
|
||||
// CPR - Request Cursor Postion Report
|
||||
// CPR - Request Cursor Position Report
|
||||
// TODO: test
|
||||
'n' => if (@hasDecl(T, "deviceStatusReport")) try self.handler.deviceStatusReport(
|
||||
switch (action.params.len) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! IO implementation and utilities. The IO implementation is responsible
|
||||
//! for taking the config, spinning up a child process, and handling IO
|
||||
//! with the termianl.
|
||||
//! with the terminal.
|
||||
|
||||
pub usingnamespace @import("termio/message.zig");
|
||||
pub const Exec = @import("termio/Exec.zig");
|
||||
|
@ -69,7 +69,7 @@ pub const Message = union(enum) {
|
||||
}
|
||||
};
|
||||
|
||||
/// Creates a union that can be used to accomodate data that fit within an array,
|
||||
/// Creates a union that can be used to accommodate data that fit within an array,
|
||||
/// are a stable pointer, or require deallocation. This is helpful for thread
|
||||
/// messaging utilities.
|
||||
pub fn MessageData(comptime Elem: type, comptime small_size: comptime_int) type {
|
||||
|
Reference in New Issue
Block a user