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
0c4f0ee412
commit
967e3a176d
24 files changed
+656
-513
No files matched your search
@@ -3,7 +3,6 @@
|
||||
use std::io::Write;
|
||||
|
||||
use ghostty_config::config_struct;
|
||||
use ghostty_input::binding::ActionKey;
|
||||
|
||||
use crate::error::Error;
|
||||
|
||||
@@ -35,44 +34,12 @@ pub fn run(args: &[String]) -> Result<u8, Error> {
|
||||
}
|
||||
|
||||
/// `helpgen_actions.generate(.plaintext, show_docs)`.
|
||||
///
|
||||
/// TODO(integration): this is a local copy of
|
||||
/// `ghostty_input::helpgen_actions::generate`. The embedded docs of a few
|
||||
/// actions in ghostty-input (`adjust_selection`, ...) end with an extra blank
|
||||
/// line compared to Ghostty's `help_strings`, which adds a stray `" "` line
|
||||
/// to `--docs` output. Trailing newlines are normalised here; once the data
|
||||
/// is fixed in ghostty-input this should call `helpgen_actions::generate`.
|
||||
#[must_use]
|
||||
pub fn generate_plaintext(show_docs: bool) -> String {
|
||||
let mut writer = String::new();
|
||||
let mut stream = String::new();
|
||||
for &key in ActionKey::ALL {
|
||||
let name = key.name();
|
||||
if name.starts_with('_') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Write previously stored doc comment below all related actions
|
||||
if show_docs {
|
||||
writer.push_str(&stream);
|
||||
writer.push('\n');
|
||||
stream.clear();
|
||||
writer.push_str(name);
|
||||
writer.push_str(":\n");
|
||||
for line in key.docs().trim_end_matches('\n').split('\n') {
|
||||
stream.push_str(" ");
|
||||
stream.push_str(line);
|
||||
stream.push('\n');
|
||||
}
|
||||
} else {
|
||||
writer.push_str(name);
|
||||
writer.push('\n');
|
||||
}
|
||||
}
|
||||
|
||||
// Write any remaining buffered documentation
|
||||
writer.push_str(&stream);
|
||||
writer
|
||||
ghostty_input::helpgen_actions::generate_string(
|
||||
ghostty_input::helpgen_actions::Format::Plaintext,
|
||||
show_docs,
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -94,15 +61,4 @@ mod tests {
|
||||
assert!(s.contains(" respectively.\n\njump_to_prompt:\n"));
|
||||
assert!(s.ends_with('\n'));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn matches_input_crate_when_docs_are_clean() {
|
||||
// The first actions have well-formed docs.
|
||||
let ours = generate_plaintext(true);
|
||||
let theirs = ghostty_input::helpgen_actions::generate_string(
|
||||
ghostty_input::helpgen_actions::Format::Plaintext,
|
||||
true,
|
||||
);
|
||||
assert!(ours.lines().take(100).eq(theirs.lines().take(100)));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user