diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-04-04 19:22:04 +0300 |
|---|---|---|
| committer | Can Celik <ogulcancelik@gmail.com> | 2026-04-05 01:23:06 +0300 |
| commit | 41dd733ca7123c9ac4bfc6c781697a660e95b052 (patch) | |
| tree | 3fc91815ca139ef2e0b281bba0abda4ef15175f4 /vendor/libghostty-vt/src/build/mdgen | |
| parent | 55c138263e190a1e79d4b997bfb9397306c0ec1f (diff) | |
feat: finish ghostty pane backend integration
Diffstat (limited to 'vendor/libghostty-vt/src/build/mdgen')
7 files changed, 401 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/src/build/mdgen/ghostty_1_footer.md b/vendor/libghostty-vt/src/build/mdgen/ghostty_1_footer.md new file mode 100644 index 00000000..a63a85fd --- /dev/null +++ b/vendor/libghostty-vt/src/build/mdgen/ghostty_1_footer.md @@ -0,0 +1,64 @@ +# FILES + +_\$XDG_CONFIG_HOME/ghostty/config.ghostty_ + +: Location of the default configuration file. + +_\$HOME/Library/Application Support/com.mitchellh.ghostty/config.ghostty_ + +: **On macOS**, location of the default configuration file. This location takes +precedence over the XDG environment locations. + +_\$LOCALAPPDATA/ghostty/config.ghostty_ + +: **On Windows**, if _\$XDG_CONFIG_HOME_ is not set, _\$LOCALAPPDATA_ will be searched +for configuration files. + +# ENVIRONMENT + +**TERM** + +: Defaults to `xterm-ghostty`. Can be configured with the `term` configuration option. + +**GHOSTTY_RESOURCES_DIR** + +: Where the Ghostty resources can be found. + +**XDG_CONFIG_HOME** + +: Default location for configuration files. + +**$HOME/Library/Application Support/com.mitchellh.ghostty** + +: **MACOS ONLY** default location for configuration files. This location takes +precedence over the XDG environment locations. + +**LOCALAPPDATA** + +: **WINDOWS ONLY:** alternate location to search for configuration files. + +**GHOSTTY_LOG** + +: The `GHOSTTY_LOG` environment variable can be used to control which +destinations receive logs. Ghostty currently defines two destinations: + +: - `stderr` - logging to `stderr`. +: - `macos` - logging to macOS's unified log (has no effect on non-macOS platforms). + +: Combine values with a comma to enable multiple destinations. Prefix a +destination with `no-` to disable it. Enabling and disabling destinations +can be done at the same time. Setting `GHOSTTY_LOG` to `true` will enable all +destinations. Setting `GHOSTTY_LOG` to `false` will disable all destinations. + +# BUGS + +See GitHub issues: <https://github.com/ghostty-org/ghostty/issues> + +# AUTHOR + +Mitchell Hashimoto <m@mitchellh.com> +Ghostty contributors <https://github.com/ghostty-org/ghostty/graphs/contributors> + +# SEE ALSO + +**ghostty(5)** diff --git a/vendor/libghostty-vt/src/build/mdgen/ghostty_1_header.md b/vendor/libghostty-vt/src/build/mdgen/ghostty_1_header.md new file mode 100644 index 00000000..c94ae68c --- /dev/null +++ b/vendor/libghostty-vt/src/build/mdgen/ghostty_1_header.md @@ -0,0 +1,23 @@ +% GHOSTTY(1) Version @@VERSION@@ | Ghostty terminal emulator + +# NAME + +**ghostty** - Ghostty terminal emulator + +# DESCRIPTION + +Ghostty is a cross-platform, GPU-accelerated terminal emulator that aims to push +the boundaries of what is possible with a terminal emulator by exposing modern, +opt-in features that enable CLI tool developers to build more feature rich, +interactive applications. + +There are a number of excellent terminal emulator options that exist today. +The unique goal of Ghostty is to have a platform for experimenting with modern, +optional, non-standards-compliant features to enhance the capabilities of CLI +applications. We aim to be the best in this category, and competitive in the +rest. + +While aiming for this ambitious goal, Ghostty is a fully standards compliant +terminal emulator that aims to remain compatible with all existing shells and +software. You can use this as a drop-in replacement for your existing terminal +emulator. diff --git a/vendor/libghostty-vt/src/build/mdgen/ghostty_5_footer.md b/vendor/libghostty-vt/src/build/mdgen/ghostty_5_footer.md new file mode 100644 index 00000000..d2cf024d --- /dev/null +++ b/vendor/libghostty-vt/src/build/mdgen/ghostty_5_footer.md @@ -0,0 +1,43 @@ +# FILES + +_\$XDG_CONFIG_HOME/ghostty/config.ghostty_ + +: Location of the default configuration file. + +_\$HOME/Library/Application Support/com.mitchellh.ghostty/config.ghostty_ + +: **On macOS**, location of the default configuration file. This location takes +precedence over the XDG environment locations. + +_\$LOCALAPPDATA/ghostty/config.ghostty_ + +: **On Windows**, if _\$XDG_CONFIG_HOME_ is not set, _\$LOCALAPPDATA_ will be searched +for configuration files. + +# ENVIRONMENT + +**XDG_CONFIG_HOME** + +: Default location for configuration files. + +**$HOME/Library/Application Support/com.mitchellh.ghostty** + +: **MACOS ONLY** default location for configuration files. This location takes +precedence over the XDG environment locations. + +**LOCALAPPDATA** + +: **WINDOWS ONLY:** alternate location to search for configuration files. + +# BUGS + +See GitHub issues: <https://github.com/ghostty-org/ghostty/issues> + +# AUTHOR + +Mitchell Hashimoto <m@mitchellh.com> +Ghostty contributors <https://github.com/ghostty-org/ghostty/graphs/contributors> + +# SEE ALSO + +**ghostty(1)** diff --git a/vendor/libghostty-vt/src/build/mdgen/ghostty_5_header.md b/vendor/libghostty-vt/src/build/mdgen/ghostty_5_header.md new file mode 100644 index 00000000..ce3196eb --- /dev/null +++ b/vendor/libghostty-vt/src/build/mdgen/ghostty_5_header.md @@ -0,0 +1,122 @@ +% GHOSTTY(5) Version @@VERSION@@ | Ghostty terminal emulator configuration file + +# NAME + +**ghostty** - Ghostty terminal emulator configuration file + +# DESCRIPTION + +To configure Ghostty, you must use a configuration file. GUI-based configuration +is on the roadmap but not yet supported. The configuration file must be placed +at `$XDG_CONFIG_HOME/ghostty/config.ghostty`, which defaults to `~/.config/ghostty/config.ghostty` +if the [XDG environment is not set](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html). + +**If you are using macOS, the configuration file can also be placed at +`$HOME/Library/Application Support/com.mitchellh.ghostty/config.ghostty`.** This is the +default configuration location for macOS. It will be searched before any of the +XDG environment locations listed above. + +The file format is documented below as an example: + + # The syntax is "key = value". The whitespace around the equals doesn't matter. + background = 282c34 + foreground= ffffff + + # Blank lines are ignored! + + keybind = ctrl+z=close_surface + keybind = ctrl+d=new_split:right + + # Colors can be changed by setting the 16 colors of `palette`, which each color + # being defined as regular and bold. + # + # black + palette = 0=#1d2021 + palette = 8=#7c6f64 + # red + palette = 1=#cc241d + palette = 9=#fb4934 + # green + palette = 2=#98971a + palette = 10=#b8bb26 + # yellow + palette = 3=#d79921 + palette = 11=#fabd2f + # blue + palette = 4=#458588 + palette = 12=#83a598 + # purple + palette = 5=#b16286 + palette = 13=#d3869b + # aqua + palette = 6=#689d6a + palette = 14=#8ec07c + # white + palette = 7=#a89984 + palette = 15=#fbf1c7 + +You can view all available configuration options and their documentation by +executing the command `ghostty +show-config --default --docs`. Note that this will +output the full default configuration with docs to stdout, so you may want to +pipe that through a pager, an editor, etc. + +Note: You'll see a lot of weird blank configurations like `font-family =`. This +is a valid syntax to specify the default behavior (no value). The `+show-config` +outputs it so it's clear that key is defaulting and also to have something to +attach the doc comment to. + +You can also see and read all available configuration options in the source +Config structure. The available keys are the keys verbatim, and their possible +values are typically documented in the comments. You also can search for +the public config files of many Ghostty users for examples and inspiration. + +## Configuration Errors + +If your configuration file has any errors, Ghostty does its best to ignore +them and move on. Configuration errors will be logged. + +## Debugging Configuration + +You can verify that configuration is being properly loaded by looking at the +debug output of Ghostty. + +In the debug output, you should see in the first 20 lines or so messages about +loading (or not loading) a configuration file, as well as any errors it may have +encountered. Configuration errors are also shown in a dedicated window on both +macOS and Linux (GTK). Ghostty does not treat configuration errors as fatal and +will fall back to default values for erroneous keys. + +You can also view the full configuration Ghostty is loading using `ghostty ++show-config` from the command-line. Use the `--help` flag to additional options +for that command. + +## Logging + +Ghostty can write logs to a number of destinations. On all platforms, logging to +`stderr` is available. Depending on the platform and how Ghostty was launched, +logs sent to `stderr` may be stored by the system and made available for later +retrieval. + +On Linux if Ghostty is launched by the default `systemd` user service, you can use +`journald` to see Ghostty's logs: `journalctl --user --unit app-com.mitchellh.ghostty.service`. + +On macOS logging to the macOS unified log is available and enabled by default. +--Use the system `log` CLI to view Ghostty's logs: `sudo log stream --level debug +--predicate 'subsystem=="com.mitchellh.ghostty"'`. + +Ghostty's logging can be configured in two ways. The first is by what +optimization level Ghostty is compiled with. If Ghostty is compiled with `Debug` +optimizations debug logs will be output to `stderr`. If Ghostty is compiled with +any other optimization the debug logs will not be output to `stderr`. + +Ghostty also checks the `GHOSTTY_LOG` environment variable. It can be used +to control which destinations receive logs. Ghostty currently defines two +destinations: + +- `stderr` - logging to `stderr`. +- `macos` - logging to macOS's unified log (has no effect on non-macOS platforms). + +Combine values with a comma to enable multiple destinations. Prefix a +destination with `no-` to disable it. Enabling and disabling destinations +can be done at the same time. Setting `GHOSTTY_LOG` to `true` will enable all +destinations. Setting `GHOSTTY_LOG` to `false` will disable all destinations. diff --git a/vendor/libghostty-vt/src/build/mdgen/main_ghostty_1.zig b/vendor/libghostty-vt/src/build/mdgen/main_ghostty_1.zig new file mode 100644 index 00000000..2bb413d9 --- /dev/null +++ b/vendor/libghostty-vt/src/build/mdgen/main_ghostty_1.zig @@ -0,0 +1,16 @@ +const std = @import("std"); +const gen = @import("mdgen.zig"); + +pub fn main() !void { + var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; + const alloc = gpa.allocator(); + + var buffer: [1024]u8 = undefined; + var stdout_writer = std.fs.File.stdout().writer(&buffer); + const writer = &stdout_writer.interface; + try gen.substitute(alloc, @embedFile("ghostty_1_header.md"), writer); + try gen.genActions(writer); + try gen.genConfig(writer, true); + try gen.substitute(alloc, @embedFile("ghostty_1_footer.md"), writer); + try writer.flush(); +} diff --git a/vendor/libghostty-vt/src/build/mdgen/main_ghostty_5.zig b/vendor/libghostty-vt/src/build/mdgen/main_ghostty_5.zig new file mode 100644 index 00000000..2123b0bc --- /dev/null +++ b/vendor/libghostty-vt/src/build/mdgen/main_ghostty_5.zig @@ -0,0 +1,16 @@ +const std = @import("std"); +const gen = @import("mdgen.zig"); + +pub fn main() !void { + var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; + const alloc = gpa.allocator(); + + var buffer: [1024]u8 = undefined; + var stdout_writer = std.fs.File.stdout().writer(&buffer); + const writer = &stdout_writer.interface; + try gen.substitute(alloc, @embedFile("ghostty_5_header.md"), writer); + try gen.genConfig(writer, false); + try gen.genKeybindActions(writer); + try gen.substitute(alloc, @embedFile("ghostty_5_footer.md"), writer); + try writer.flush(); +} diff --git a/vendor/libghostty-vt/src/build/mdgen/mdgen.zig b/vendor/libghostty-vt/src/build/mdgen/mdgen.zig new file mode 100644 index 00000000..530c8964 --- /dev/null +++ b/vendor/libghostty-vt/src/build/mdgen/mdgen.zig @@ -0,0 +1,117 @@ +const std = @import("std"); +const help_strings = @import("help_strings"); +const build_config = @import("../../build_config.zig"); +const Config = @import("../../config/Config.zig"); +const Action = @import("../../cli/ghostty.zig").Action; +const KeybindAction = @import("../../input/Binding.zig").Action; + +pub fn substitute(alloc: std.mem.Allocator, input: []const u8, writer: *std.Io.Writer) !void { + const output = try alloc.alloc(u8, std.mem.replacementSize( + u8, + input, + "@@VERSION@@", + build_config.version_string, + )); + defer alloc.free(output); + + _ = std.mem.replace(u8, input, "@@VERSION@@", build_config.version_string, output); + try writer.writeAll(output); +} + +pub fn genConfig(writer: *std.Io.Writer, cli: bool) !void { + try writer.writeAll( + \\ + \\# CONFIGURATION OPTIONS + \\ + \\ + ); + + @setEvalBranchQuota(5000); + inline for (@typeInfo(Config).@"struct".fields) |field| { + if (field.name[0] == '_') continue; + + try writer.writeAll("**`"); + if (cli) try writer.writeAll("--"); + try writer.writeAll(field.name); + try writer.writeAll("`**\n\n"); + if (@hasDecl(help_strings.Config, field.name)) { + var iter = std.mem.splitScalar(u8, @field(help_strings.Config, field.name), '\n'); + var first = true; + while (iter.next()) |s| { + try writer.writeAll(if (first) ": " else " "); + try writer.writeAll(s); + try writer.writeAll("\n"); + first = false; + } + try writer.writeAll("\n\n"); + } + } +} + +pub fn genActions(writer: *std.Io.Writer) !void { + try writer.writeAll( + \\ + \\# COMMAND LINE ACTIONS + \\ + \\ + ); + + inline for (@typeInfo(Action).@"enum".fields) |field| { + const action = std.meta.stringToEnum(Action, field.name).?; + + switch (action) { + .help => try writer.writeAll("**`--help`**\n\n"), + .version => try writer.writeAll("**`--version`**\n\n"), + else => { + try writer.writeAll("**`+"); + try writer.writeAll(field.name); + try writer.writeAll("`**\n\n"); + }, + } + + if (@hasDecl(help_strings.Action, field.name)) { + var iter = std.mem.splitScalar(u8, @field(help_strings.Action, field.name), '\n'); + var first = true; + while (iter.next()) |s| { + try writer.writeAll(if (first) ": " else " "); + try writer.writeAll(s); + try writer.writeAll("\n"); + first = false; + } + try writer.writeAll("\n\n"); + } + } +} + +pub fn genKeybindActions(writer: *std.Io.Writer) !void { + try writer.writeAll( + \\ + \\# KEYBIND ACTIONS + \\ + \\ + ); + + const info = @typeInfo(KeybindAction); + std.debug.assert(info == .@"union"); + + @setEvalBranchQuota(5000); + inline for (info.@"union".fields) |field| { + if (field.name[0] == '_') continue; + + try writer.writeAll("**`"); + try writer.writeAll(field.name); + try writer.writeAll("`**\n\n"); + + if (@hasDecl(help_strings.KeybindAction, field.name)) { + var iter = std.mem.splitScalar(u8, @field(help_strings.KeybindAction, field.name), '\n'); + var first = true; + while (iter.next()) |s| { + try writer.writeAll(if (first) ": " else " "); + try writer.writeAll(s); + try writer.writeAll("\n"); + first = false; + } + try writer.writeAll("\n\n"); + } + } +} |
