refactor: resolve cross-crate integration TODOs and resources discovery
Cleanup pass over items collected in docs/rewrite/INTEGRATION_TODO.md: - OSC 133 printf-q / percent decoders live once in ghostty_vt::string_encoding; ghostty-os re-exports them. - CursorStyle and clipboard codepoint map entries have one definition (ghostty-terminal); ghostty-config now depends on ghostty-terminal. - ActionKey::docs() trailing blank lines fixed at the source; cli's workaround removed (+list-actions --docs still byte-identical). - x11_color exposes names in original case; cli no longer re-parses rgb.txt. - One cgroup scope wait loop (ghostty_os::cgroup::wait_for_scope). - Flatpak passwd lookup implemented in ghostty-os via a local pty. - +version shows the rustc version captured at build time. Resources: dev builds find <workspace>/resources automatically (keeping Ghostty's sentinel-file detection and GHOSTTY_RESOURCES_DIR); scripts/gen-terminfo.sh (just terminfo) regenerates the compiled terminfo; `just install [PREFIX]` installs binary, share/ghostty, terminfo, desktop/D-Bus/systemd/metainfo files and icons. Test Plan: - cargo test for vt, os, config, input, cli - diff `+list-keybinds`, `+list-actions --docs`, `+show-config --default` against /usr/bin/ghostty
This commit is contained in:
1 parent
062c643ea8
commit
7868e56273
24 files changed
+656
-513
No files matched your search
@@ -8,6 +8,7 @@ license.workspace = true
|
||||
const_format = "0.2.36"
|
||||
ghostty-input.workspace = true
|
||||
ghostty-os.workspace = true
|
||||
ghostty-terminal.workspace = true
|
||||
ghostty-vt.workspace = true
|
||||
log = "0.4.34"
|
||||
thiserror = "2.0.21"
|
||||
|
||||
@@ -2,27 +2,10 @@
|
||||
//! for clipboard operations. When copying text to clipboard, matching
|
||||
//! codepoints will be replaced with their mapped values.
|
||||
|
||||
/// Replacement value for a codepoint range.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum Replacement {
|
||||
/// A single replacement codepoint.
|
||||
Codepoint(u32),
|
||||
/// A UTF-8 encoded string to replace with.
|
||||
String(String),
|
||||
}
|
||||
|
||||
/// One entry of the map.
|
||||
///
|
||||
/// TODO(integration): this mirrors `terminal/formatter.zig` `CodepointMap`;
|
||||
/// replace with `ghostty_terminal::formatter::CodepointMap` once available.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Entry {
|
||||
/// Unicode codepoint range to replace.
|
||||
/// Asserts: range[0] <= range[1]
|
||||
pub range: [u32; 2],
|
||||
/// Replacement value for this range.
|
||||
pub replacement: Replacement,
|
||||
}
|
||||
/// One entry of the map and its replacement value. The canonical
|
||||
/// definitions live in `ghostty_terminal::formatter` (`CodepointMap`,
|
||||
/// `Replacement`), which is what the terminal formatter consumes.
|
||||
pub use ghostty_terminal::formatter::{CodepointMap as Entry, Replacement};
|
||||
|
||||
/// The list of entries.
|
||||
///
|
||||
|
||||
@@ -21,23 +21,35 @@ fn write_void(f: &mut EntryFormatter<'_>) -> fmt::Result {
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Cursor style (ZIG/src/terminal/cursor.zig `Style`), duplicated here
|
||||
// because config cannot depend on ghostty-terminal.
|
||||
// Cursor style: the canonical type is `ghostty_terminal::cursor::Style`
|
||||
// (ZIG/src/terminal/cursor.zig `Style`); config only adds the field impl.
|
||||
|
||||
config_enum! {
|
||||
/// The visual style of the cursor. Whether or not it blinks
|
||||
/// is determined by mode 12 (modes.zig). This mode is synchronized
|
||||
/// with CSI q, the same as xterm.
|
||||
pub enum CursorStyle {
|
||||
/// DECSCUSR 5, 6
|
||||
Bar => "bar",
|
||||
/// DECSCUSR 1, 2
|
||||
Block => "block",
|
||||
/// DECSCUSR 3, 4
|
||||
Underline => "underline",
|
||||
/// Hollow block cursor. This is a block cursor with the center empty.
|
||||
/// Reported as DECSCUSR 1 or 2 (block).
|
||||
BlockHollow => "block_hollow",
|
||||
pub use ghostty_terminal::cursor::Style as CursorStyle;
|
||||
|
||||
impl ConfigField for CursorStyle {
|
||||
const VALID_VALUES: Option<&'static [&'static str]> =
|
||||
Some(&["bar", "block", "underline", "block_hollow"]);
|
||||
|
||||
fn parse_cli(&mut self, value: Option<&str>) -> Result<(), ArgError> {
|
||||
let v = value.ok_or(ArgError::ValueRequired)?;
|
||||
*self = match v {
|
||||
"bar" => CursorStyle::Bar,
|
||||
"block" => CursorStyle::Block,
|
||||
"underline" => CursorStyle::Underline,
|
||||
"block_hollow" => CursorStyle::BlockHollow,
|
||||
_ => return Err(ArgError::InvalidValue),
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn format_entry(&self, f: &mut EntryFormatter<'_>) -> fmt::Result {
|
||||
let name = match self {
|
||||
CursorStyle::Bar => "bar",
|
||||
CursorStyle::Block => "block",
|
||||
CursorStyle::Underline => "underline",
|
||||
CursorStyle::BlockHollow => "block_hollow",
|
||||
};
|
||||
writeln!(f.writer, "{} = {}", f.name, name)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user