Mitchell Hashimoto
270d454c4e
webgen: update config to support callouts, emit keybind actions
2024-12-19 17:15:39 -08:00
Sam Atman
8cadc7030c
Change to F3 legacy encoding with modifiers
...
The [fixterms](http://www.leonerd.org.uk/hacks/fixterms/ ) "Really
Special Keypresses" section suggests using CSI 1 ; Ps R for F3, but this
is also a valid cursor position report. The intention was to make back-
compatible changes, so this is fairly considered a specification bug.
This changes F3 in legacy mode to send CSI 13 ; Ps ~ instead, this is a
variant listed in fixterms, is what kitty protocol uses, and lacks the
problematic overlap with cursor positions.
The KeyEncoder.zig unit test has been changed accordingly, and all tests
pass on my machine.
2024-12-19 17:05:29 -05:00
Mitchell Hashimoto
d6e7685816
Docfix: correct comment for modifyOtherKeys sequence ( #3018 )
...
The comment in `function_keys.zig` was missing the `>` character for the
sequence. I've confirmed that this was just the comment, Ghostty treats
the original as an SGR sequence, which it is. Conversely, it does treat
`\x1b[>4;2m` as activating modifyOtherKeys.
2024-12-19 14:02:56 -08:00
Sam Atman
d885a266d4
Docfix: correct comment for modifyOtherKeys sequence
...
The comment in `function_keys.zig` was missing the `>` character for the
sequence. I've confirmed that this was just the comment, Ghostty treats
the original as an SGR sequence, which it is. Conversely, it does treat
`\x1b[>4:2m` as activating modifyOtherKeys.
2024-12-19 16:51:28 -05:00
Mitchell Hashimoto
fa3896be03
Fix emoji size and atlas padding ( #3016 )
...
Fixes a bug where emojis got smaller when font thicken was enabled
because they were constrained for some reason, here demonstrated by
artificially narrowing the cells with `adjust-cell-width=-45%`:
|`font-thicken`|main|this PR|
|-|-|-|
|`false`|<img width="328" alt="image"
src="https://github.com/user-attachments/assets/c5c25d94-ea73-47e1-80e9-ed3baff76511 "
/>|<img width="328" alt="image"
src="https://github.com/user-attachments/assets/f74a35e1-ab7e-470d-b873-f33e63c1c9bb "
/>|
|`true`|<img width="328" alt="image"
src="https://github.com/user-attachments/assets/e7c1e096-4a54-456c-afb0-5adcb94eaf00 "
/>|<img width="328" alt="image"
src="https://github.com/user-attachments/assets/80d3d7dd-f572-489a-ab56-d2d5ca9f3508 "
/>|
And reworks the CoreText atlas margin/padding calculations to be more
efficient, you can see comparisons with and without thicken both before
and after this change here:
<details>
<summary>Atlas Textures</summary>
### main
|`font-thicken`|gray|color|
|-|-|-|
|`false`|||
|`true`|||
### this PR
|`font-thicken`|gray|color|
|-|-|-|
|`false`|||
|`true`|||
</details>
The atlas padding calculations were also affecting the issue with the
emojis getting smaller when thicken was enabled, because they were given
extra space to account for the thickening but they're bitmap so they
don't get affected by thickening.
2024-12-19 13:31:06 -08:00
Qwerasd
0e21293d43
font(coretext): improve atlas padding calculations
...
- Simplifies and clarifies the math for how the bounding box for
rendered glyphs is computed
- Reduces margin from 2px between glyphs to 1px by only padding the
bottom and right side of each glyph
- Avoids excessive padding to glyph box when font thicken is enabled or
when using a synthetic bold (it was previously 4x as much padding as
necessary in some cases)
2024-12-19 13:30:52 -08:00
Niclas van Eyk
7d71eabae8
docs: fix referenced toggle window decorations action name
2024-12-19 22:05:59 +01:00
Qwerasd
4ca6413ec9
renderer: do not constrain color glyphs
...
There is no reason to and I do not know where this assumption came from.
It's very possible for a colored glyph to (intentionally!) exceed the
cell bounds, and we shouldn't be stopping this...
2024-12-19 11:21:57 -05:00
Mitchell Hashimoto
82c9787fd3
build: generate reference page for config for website
2024-12-18 07:06:35 -08:00
Mitchell Hashimoto
34dca8149b
bash: improve clearing of multiline prompts ( #3003 )
...
Bash doesn't redraw the leading lines in a multiline prompt so we mark
the last line as a secondary prompt (k=s) to prevent the preceding lines
from being erased by Ghostty after a resize.
Our previously attempt at this (#1973 ) was flawed. Instead, we now just
re-issue the OSC "133;A" command with a 'k=s' (secondary) kind at the
end of our prompt string.
This isn't a great solution because it stomps on the prompt's "133;B"
command (end of prompt and start of user input), but it's sufficient for
now and only applies in the multiline prompt case.
Going forward, we should revisit our semantic prompt implementation. Our
row-based approach is too limiting; lines can have multiple markers, and
markers should be recorded with their full coordinates so they can form
ranges.
See: https://per.bothner.com/blog/2019/shell-integration-proposal/
Fixes : #1961
2024-12-17 14:17:41 -08:00
Jon Parise
63747d1e22
bash: improve clearing of multiline prompts
...
Bash doesn't redraw the leading lines in a multiline prompt so we mark
the last line as a secondary prompt (k=s) to prevent the preceding lines
from being erased by Ghostty after a resize.
Our previously attempt at this (#1973 ) was flawed. Instead, we now just
re-issue the OSC "133;A" command with a 'k=s' (secondary) kind at the
end of our prompt string.
This isn't a great solution because it stomps on the prompt's "133;B"
command (end of prompt and start of user input), but it's sufficient for
now and only applies in the multiline prompt case.
Going forward, we should revisit our semantic prompt implementation. Our
row-based approach is too limiting; lines can have multiple markers, and
markers should be recorded with their full coordinates so they can form
ranges.
See: https://per.bothner.com/blog/2019/shell-integration-proposal/
2024-12-17 16:28:41 -05:00
Jon Parise
a2c546c8d1
config: disable forced shell integration for -e
...
This prevents forcibly injecting any configured shell integration into
the command's environment. Automatic shell detection is enabled, unless
shell integration has been explicitly disabled.
2024-12-17 12:12:51 -08:00
Jeffrey C. Ollie
82e67430cd
cli: add +show-face CLI action
...
This CLI action shows what font face Ghostty will use to display
a particular codepoint.
2024-12-17 13:09:32 -06:00
Jeffrey C. Ollie
813c48cb12
core: allow u21 as a cli argument type
2024-12-17 13:08:48 -06:00
Jeffrey C. Ollie
97a2b94c9b
core: allow cli actions to use arg parsing diagnostics
2024-12-17 13:07:48 -06:00
Anund
38b42fc970
shell-integration: add bashrc location lookup in Nixos
...
fixes #2979
2024-12-17 21:49:15 +11:00
Mitchell Hashimoto
ae6c4c3f0c
terminal: handle consecutive .input's in clearPrompt ( #2990 )
...
Our semantic prompts are row-based, so the last prompt marker set on a
row "wins". In the case of at least our bash shell integration, this
means that consecutive prompt lines will all be marked as .input (OSC
133;B -- end-of-prompt, start of input).
Previously, clearPrompt() identified the current prompt's "area" by
searching upward from the current row until it encounters a .prompt
marker or some command output. In the bash case, .prompt is never the
dominant ("last") marker, so clearPrompt() would aggressively clear all
immediately preceding consecutive prompts.
With this change, we'll stop searching upwards when we encounter some
command output, a .prompt marker, _or another .input marker_. That last
case prevents clearPrompt() from unintentionally clearing earlier prompt
lines.
There may be improvements we can make to the way that our bash shell
integration emits semantic prompt markers, but I think this logic is
generally sound for all cases, and it specifically improves the current
bash prompt-clearing experience.
---
Before and after, after resizing the terminal window to trigger a
reflow:
<img width="504"
src="https://github.com/user-attachments/assets/91aa652e-e262-445a-8eed-7268c0d66428 "
/>
<img width="510"
src="https://github.com/user-attachments/assets/b43e0aa4-0e24-4f4e-9b2c-b6b07c8f8c77 "
/>
2024-12-16 21:08:21 -08:00
Jon Parise
82756f8b4c
terminal: handle consecutive .input's in clearPrompt
...
Our semantic prompts are row-based, so the last prompt marker set on a
row "wins". In the case of at least our bash shell integration, this
means that consecutive prompt lines will all be marked as .input (OSC
133;B -- end-of-prompt, start of input).
Previously, clearPrompt() identified the current prompt's "area" by
searching upward from the current row until it encounters a .prompt
marker or some command output. In the bash case, .prompt is never the
dominant ("last") marker, so clearPrompt() would aggressively clear all
immediately preceding consecutive prompts.
With this change, we'll stop searching upwards when we encounter some
command output, a .prompt marker, _or another .input marker_. That last
case prevents clearPrompt() from unintentionally clearing earlier prompt
lines.
There may be improvements we can make to the way that our bash shell
integration emits semantic prompt markers, but I think this logic is
generally sound for all cases, and it specifically improves the current
bash prompt-clearing experience.
2024-12-16 21:06:15 -08:00
Jeffrey C. Ollie
7816705898
build: allow CLI actions to have enum option values
...
A typo in the fish completions (that was likely copied to the zsh and
bash completions) prevented CLI actions from using enums as option
values because the completions tried to access non-existent fields from
type introspection. This doesn't cause any problems _now_ because no CLI
action uses an enum as an option value. However as soon as you try and
add one the completions fail to compile.
This patch fixes the incorrect field reference. It also adds the ability
to have _optional_ enums as option values.
2024-12-16 18:03:32 -06:00
Mitchell Hashimoto
56f285cbc2
Handle fonts with missing or invalid OS/2 tables ( #2985 )
...
It turns out this happens more than I thought. Most notably, apple's
fallback font for a bunch of symbols, `Apple Gothic`, has no OS/2 table
🙃 . I've gone ahead and fixed it so that both CoreText and FreeType
handle this gracefully.
Speaking of graceful handling, this problem came to attention due to our
very *un*-graceful handling of when a font fails to load due to a
metrics calculation error. It results in a bunch of blanked out text,
very bad, we should fix that.
*At some point I'll try to collect a group of test fonts with all sorts
of weirdnesses to exercise the weird edge cases in our handling.*
2024-12-16 12:43:59 -08:00
Mitchell Hashimoto
2b78ac4382
font: style edits for #2985
2024-12-16 12:30:34 -08:00
Mitchell Hashimoto
bd48dcc748
os: add prependEnv(), like appendEnv() ( #2983 )
...
We can use this function in setupXdgDataDirs() to simplify the
XDG_DATA_DIRS environment variable code in a more standardized way.
2024-12-16 12:24:29 -08:00
Qwerasd
a06388869d
fix: sCapHeight and sxHeight only exist when OS/2 version >= 2
2024-12-16 15:20:26 -05:00
Qwerasd
13e4861dff
font(freetype): tolerate fonts without OS/2 tables
...
This is more common than anticipated, so proper fallback logic has been
added. Why must fonts be like this? -.-
2024-12-16 14:53:29 -05:00
Qwerasd
5cd214066d
font(coretext): tolerate fonts without OS/2 tables
...
This creates big problems if we don't, since a lot of symbols end up
falling back to Apple Gothic, which doesn't have an OS/2 table.
2024-12-16 14:52:07 -05:00
Aaron Bull Schaefer
7999423244
docs: fix typo
2024-12-16 08:00:29 -08:00
Jon Parise
f141f4b2b0
os: add prependEnv(), like appendEnv()
...
We can use this function in setupXdgDataDirs() to simplify the
XDG_DATA_DIRS environment variable code in a more standardized way.
2024-12-16 10:56:27 -05:00
Mitchell Hashimoto
8814844a45
macos: add our application bundle to XDG_DATA_DIRS ( #2974 )
...
We're packaging more and more application-specific data directories in
our application bundle. It's helpful to add that path to XDG_DATA_DIRS
so those applications (that support XDG_DATA_DIRS) can locate their data
directories without additional user-level configuration.
This also fixes a typo ("MATHPATH") in the nearby MANPATH-building code.
2024-12-15 21:27:14 -08:00
Jon Parise
d981ddf128
macos: add our application bundle to XDG_DATA_DIRS
...
We're packaging more and more application-specific data directories in
our application bundle. It's helpful to add that path to XDG_DATA_DIRS
so those applications (that support XDG_DATA_DIRS) can locate their data
directories without additional user-level configuration.
This also fixes a typo ("MATHPATH") in the nearby MANPATH-building code.
2024-12-15 21:24:43 -08:00
Mitchell Hashimoto
0ad4b6bf44
bash: add bash completion generation ( #2963 )
...
Bash completions on par with fish and zsh completions. There's a lot of
room to add additional custom completions in all three languages. (see
`key) return;;` for cases)
I've noticed a few mistakes with the other completions I'll raise as a
separate PR.
<details>
<summary>Generated ghostty.bash - updated</summary>
```bash
# -o nospace requires we add back a space when a completion is finished
# and not part of a --key= completion
addSpaces() {
for idx in "${!COMPREPLY[@]}"; do
[ -n "${COMPREPLY[idx]}" ] && COMPREPLY[idx]="${COMPREPLY[idx]} ";
done
}
_fonts() {
local IFS=$'\n'
mapfile -t COMPREPLY < <( compgen -P '"' -S '"' -W "$($ghostty +list-fonts | grep '^[A-Z]' )" -- "$cur")
}
_themes() {
local IFS=$'\n'
mapfile -t COMPREPLY < <( compgen -P '"' -S '"' -W "$($ghostty +list-themes | sed -E 's/^(.*) \(.*$/\1/')" -- "$cur")
}
_files() {
mapfile -t COMPREPLY < <( compgen -o filenames -f -- "$cur" )
for i in "${!COMPREPLY[@]}"; do
if [[ -d "${COMPREPLY[i]}" ]]; then
COMPREPLY[i]="${COMPREPLY[i]}/";
fi
if [[ -f "${COMPREPLY[i]}" ]]; then
COMPREPLY[i]="${COMPREPLY[i]} ";
fi
done
}
_dirs() {
mapfile -t COMPREPLY < <( compgen -o dirnames -d -- "$cur" )
for i in "${!COMPREPLY[@]}"; do
if [[ -d "${COMPREPLY[i]}" ]]; then
COMPREPLY[i]="${COMPREPLY[i]}/";
fi
done
if [[ "${#COMPREPLY[@]}" == 0 && -d "$cur" ]]; then
COMPREPLY=( "$cur " )
fi
}
config="--help"
config+=" --version"
config+=" --font-family="
config+=" --font-family-bold="
config+=" --font-family-italic="
config+=" --font-family-bold-italic="
config+=" --font-style="
config+=" --font-style-bold="
config+=" --font-style-italic="
config+=" --font-style-bold-italic="
config+=" --font-synthetic-style="
config+=" --font-feature="
config+=" --font-size="
config+=" --font-variation="
config+=" --font-variation-bold="
config+=" --font-variation-italic="
config+=" --font-variation-bold-italic="
config+=" --font-codepoint-map="
config+=" --font-thicken="
config+=" --adjust-cell-width="
config+=" --adjust-cell-height="
config+=" --adjust-font-baseline="
config+=" --adjust-underline-position="
config+=" --adjust-underline-thickness="
config+=" --adjust-strikethrough-position="
config+=" --adjust-strikethrough-thickness="
config+=" --adjust-cursor-thickness="
config+=" --grapheme-width-method="
config+=" --freetype-load-flags="
config+=" --theme="
config+=" --background="
config+=" --foreground="
config+=" --selection-foreground="
config+=" --selection-background="
config+=" --selection-invert-fg-bg="
config+=" --minimum-contrast="
config+=" --palette="
config+=" --cursor-color="
config+=" --cursor-invert-fg-bg="
config+=" --cursor-opacity="
config+=" --cursor-style="
config+=" --cursor-style-blink="
config+=" --cursor-text="
config+=" --cursor-click-to-move="
config+=" --mouse-hide-while-typing="
config+=" --mouse-shift-capture="
config+=" --mouse-scroll-multiplier="
config+=" --background-opacity="
config+=" --background-blur-radius="
config+=" --unfocused-split-opacity="
config+=" --unfocused-split-fill="
config+=" --command="
config+=" --initial-command="
config+=" --wait-after-command="
config+=" --abnormal-command-exit-runtime="
config+=" --scrollback-limit="
config+=" --link="
config+=" --link-url="
config+=" --fullscreen="
config+=" --title="
config+=" --class="
config+=" --x11-instance-name="
config+=" --working-directory="
config+=" --keybind="
config+=" --window-padding-x="
config+=" --window-padding-y="
config+=" --window-padding-balance="
config+=" --window-padding-color="
config+=" --window-vsync="
config+=" --window-inherit-working-directory="
config+=" --window-inherit-font-size="
config+=" --window-decoration="
config+=" --window-title-font-family="
config+=" --window-theme="
config+=" --window-colorspace="
config+=" --window-height="
config+=" --window-width="
config+=" --window-save-state="
config+=" --window-step-resize="
config+=" --window-new-tab-position="
config+=" --resize-overlay="
config+=" --resize-overlay-position="
config+=" --resize-overlay-duration="
config+=" --focus-follows-mouse="
config+=" --clipboard-read="
config+=" --clipboard-write="
config+=" --clipboard-trim-trailing-spaces="
config+=" --clipboard-paste-protection="
config+=" --clipboard-paste-bracketed-safe="
config+=" --image-storage-limit="
config+=" --copy-on-select="
config+=" --click-repeat-interval="
config+=" --config-file="
config+=" --config-default-files="
config+=" --confirm-close-surface="
config+=" --quit-after-last-window-closed="
config+=" --quit-after-last-window-closed-delay="
config+=" --initial-window="
config+=" --quick-terminal-position="
config+=" --quick-terminal-screen="
config+=" --quick-terminal-animation-duration="
config+=" --shell-integration="
config+=" --shell-integration-features="
config+=" --osc-color-report-format="
config+=" --vt-kam-allowed="
config+=" --custom-shader="
config+=" --custom-shader-animation="
config+=" --macos-non-native-fullscreen="
config+=" --macos-titlebar-style="
config+=" --macos-titlebar-proxy-icon="
config+=" --macos-option-as-alt="
config+=" --macos-window-shadow="
config+=" --macos-auto-secure-input="
config+=" --macos-secure-input-indication="
config+=" --linux-cgroup="
config+=" --linux-cgroup-memory-limit="
config+=" --linux-cgroup-processes-limit="
config+=" --linux-cgroup-hard-fail="
config+=" --gtk-single-instance="
config+=" --gtk-titlebar="
config+=" --gtk-tabs-location="
config+=" --adw-toolbar-style="
config+=" --gtk-wide-tabs="
config+=" --gtk-adwaita="
config+=" --desktop-notifications="
config+=" --bold-is-bright="
config+=" --term="
config+=" --enquiry-response="
config+=" --auto-update="
_handleConfig() {
case "$prev" in
--font-family) _fonts ;;
--font-family-bold) _fonts ;;
--font-family-italic) _fonts ;;
--font-family-bold-italic) _fonts ;;
--font-style) return ;;
--font-style-bold) return ;;
--font-style-italic) return ;;
--font-style-bold-italic) return ;;
--font-synthetic-style) mapfile -t COMPREPLY < <( compgen -W "bold no-bold italic no-italic bold-italic no-bold-italic" -- "$cur" ); addSpaces ;;
--font-feature) return ;;
--font-size) return ;;
--font-variation) return ;;
--font-variation-bold) return ;;
--font-variation-italic) return ;;
--font-variation-bold-italic) return ;;
--font-codepoint-map) return ;;
--font-thicken) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--adjust-cell-width) return ;;
--adjust-cell-height) return ;;
--adjust-font-baseline) return ;;
--adjust-underline-position) return ;;
--adjust-underline-thickness) return ;;
--adjust-strikethrough-position) return ;;
--adjust-strikethrough-thickness) return ;;
--adjust-cursor-thickness) return ;;
--grapheme-width-method) mapfile -t COMPREPLY < <( compgen -W "legacy unicode" -- "$cur" ); addSpaces ;;
--freetype-load-flags) mapfile -t COMPREPLY < <( compgen -W "hinting no-hinting force-autohint no-force-autohint monochrome no-monochrome autohint no-autohint" -- "$cur" ); addSpaces ;;
--theme) _themes ;;
--background) return ;;
--foreground) return ;;
--selection-foreground) return ;;
--selection-background) return ;;
--selection-invert-fg-bg) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--minimum-contrast) return ;;
--palette) return ;;
--cursor-color) return ;;
--cursor-invert-fg-bg) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--cursor-opacity) return ;;
--cursor-style) mapfile -t COMPREPLY < <( compgen -W "bar block underline block_hollow" -- "$cur" ); addSpaces ;;
--cursor-style-blink) return ;;
--cursor-text) return ;;
--cursor-click-to-move) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--mouse-hide-while-typing) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--mouse-shift-capture) mapfile -t COMPREPLY < <( compgen -W "false true always never" -- "$cur" ); addSpaces ;;
--mouse-scroll-multiplier) return ;;
--background-opacity) return ;;
--background-blur-radius) return ;;
--unfocused-split-opacity) return ;;
--unfocused-split-fill) return ;;
--command) return ;;
--initial-command) return ;;
--wait-after-command) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--abnormal-command-exit-runtime) return ;;
--scrollback-limit) return ;;
--link) return ;;
--link-url) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--fullscreen) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--title) return ;;
--class) return ;;
--x11-instance-name) return ;;
--working-directory) _dirs ;;
--keybind) return ;;
--window-padding-x) return ;;
--window-padding-y) return ;;
--window-padding-balance) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--window-padding-color) mapfile -t COMPREPLY < <( compgen -W "background extend extend-always" -- "$cur" ); addSpaces ;;
--window-vsync) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--window-inherit-working-directory) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--window-inherit-font-size) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--window-decoration) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--window-title-font-family) return ;;
--window-theme) mapfile -t COMPREPLY < <( compgen -W "auto system light dark ghostty" -- "$cur" ); addSpaces ;;
--window-colorspace) mapfile -t COMPREPLY < <( compgen -W "srgb display-p3" -- "$cur" ); addSpaces ;;
--window-height) return ;;
--window-width) return ;;
--window-save-state) mapfile -t COMPREPLY < <( compgen -W "default never always" -- "$cur" ); addSpaces ;;
--window-step-resize) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--window-new-tab-position) mapfile -t COMPREPLY < <( compgen -W "current end" -- "$cur" ); addSpaces ;;
--resize-overlay) mapfile -t COMPREPLY < <( compgen -W "always never after-first" -- "$cur" ); addSpaces ;;
--resize-overlay-position) mapfile -t COMPREPLY < <( compgen -W "center top-left top-center top-right bottom-left bottom-center bottom-right" -- "$cur" ); addSpaces ;;
--resize-overlay-duration) return ;;
--clipboard-read) mapfile -t COMPREPLY < <( compgen -W "allow deny ask" -- "$cur" ); addSpaces ;;
--clipboard-write) mapfile -t COMPREPLY < <( compgen -W "allow deny ask" -- "$cur" ); addSpaces ;;
--clipboard-trim-trailing-spaces) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--clipboard-paste-protection) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--clipboard-paste-bracketed-safe) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--image-storage-limit) return ;;
--copy-on-select) mapfile -t COMPREPLY < <( compgen -W "false true clipboard" -- "$cur" ); addSpaces ;;
--click-repeat-interval) return ;;
--config-file) _files ;;
--config-default-files) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--confirm-close-surface) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--quit-after-last-window-closed) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--quit-after-last-window-closed-delay) return ;;
--initial-window) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--quick-terminal-position) mapfile -t COMPREPLY < <( compgen -W "top bottom left right" -- "$cur" ); addSpaces ;;
--quick-terminal-screen) mapfile -t COMPREPLY < <( compgen -W "main mouse macos-menu-bar" -- "$cur" ); addSpaces ;;
--quick-terminal-animation-duration) return ;;
--shell-integration) mapfile -t COMPREPLY < <( compgen -W "none detect bash elvish fish zsh" -- "$cur" ); addSpaces ;;
--shell-integration-features) mapfile -t COMPREPLY < <( compgen -W "cursor no-cursor sudo no-sudo title no-title" -- "$cur" ); addSpaces ;;
--osc-color-report-format) mapfile -t COMPREPLY < <( compgen -W "none 8-bit 16-bit" -- "$cur" ); addSpaces ;;
--vt-kam-allowed) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--custom-shader) _files ;;
--custom-shader-animation) mapfile -t COMPREPLY < <( compgen -W "false true always" -- "$cur" ); addSpaces ;;
--macos-non-native-fullscreen) mapfile -t COMPREPLY < <( compgen -W "false true visible-menu" -- "$cur" ); addSpaces ;;
--macos-titlebar-style) mapfile -t COMPREPLY < <( compgen -W "native transparent tabs hidden" -- "$cur" ); addSpaces ;;
--macos-titlebar-proxy-icon) mapfile -t COMPREPLY < <( compgen -W "visible hidden" -- "$cur" ); addSpaces ;;
--macos-option-as-alt) return ;;
--macos-window-shadow) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--macos-auto-secure-input) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--macos-secure-input-indication) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--linux-cgroup) mapfile -t COMPREPLY < <( compgen -W "never always single-instance" -- "$cur" ); addSpaces ;;
--linux-cgroup-memory-limit) return ;;
--linux-cgroup-processes-limit) return ;;
--linux-cgroup-hard-fail) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--gtk-single-instance) mapfile -t COMPREPLY < <( compgen -W "desktop false true" -- "$cur" ); addSpaces ;;
--gtk-titlebar) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--gtk-tabs-location) mapfile -t COMPREPLY < <( compgen -W "top bottom left right" -- "$cur" ); addSpaces ;;
--adw-toolbar-style) mapfile -t COMPREPLY < <( compgen -W "flat raised raised-border" -- "$cur" ); addSpaces ;;
--gtk-wide-tabs) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--gtk-adwaita) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--desktop-notifications) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--bold-is-bright) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--term) return ;;
--enquiry-response) return ;;
--auto-update) mapfile -t COMPREPLY < <( compgen -W "off check download" -- "$cur" ); addSpaces ;;
*) mapfile -t COMPREPLY < <( compgen -W "$config" -- "$cur" ) ;;
esac
return 0
}
list_fonts="--family= --style= --bold= --italic= --help"
list_keybinds="--default= --docs= --plain= --help"
list_themes="--path= --plain= --help"
list_actions="--docs= --help"
show_config="--default= --changes-only= --docs= --help"
validate_config="--config-file= --help"
_handleActions() {
case "${COMP_WORDS[1]}" in
+list-fonts)
case $prev in
--family) return;;
--style) return;;
--bold) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--italic) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
*) mapfile -t COMPREPLY < <( compgen -W "$list_fonts" -- "$cur" ) ;;
esac
;;
+list-keybinds)
case $prev in
--default) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--docs) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--plain) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
*) mapfile -t COMPREPLY < <( compgen -W "$list_keybinds" -- "$cur" ) ;;
esac
;;
+list-themes)
case $prev in
--path) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--plain) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
*) mapfile -t COMPREPLY < <( compgen -W "$list_themes" -- "$cur" ) ;;
esac
;;
+list-actions)
case $prev in
--docs) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
*) mapfile -t COMPREPLY < <( compgen -W "$list_actions" -- "$cur" ) ;;
esac
;;
+show-config)
case $prev in
--default) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--changes-only) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
--docs) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
*) mapfile -t COMPREPLY < <( compgen -W "$show_config" -- "$cur" ) ;;
esac
;;
+validate-config)
case $prev in
--config-file) _files ;;
*) mapfile -t COMPREPLY < <( compgen -W "$validate_config" -- "$cur" ) ;;
esac
;;
*) mapfile -t COMPREPLY < <( compgen -W "--help" -- "$cur" ) ;;
esac
return 0
}
topLevel="-e"
topLevel+=" --help"
topLevel+=" --version"
topLevel+=" +list-fonts"
topLevel+=" +list-keybinds"
topLevel+=" +list-themes"
topLevel+=" +list-colors"
topLevel+=" +list-actions"
topLevel+=" +show-config"
topLevel+=" +validate-config"
topLevel+=" +crash-report"
_ghostty() {
cur=""; prev=""; prevWasEq=false; COMPREPLY=()
ghostty="$1"
if [ "$2" = "=" ]; then cur=""
else cur="$2"
fi
if [ "$3" = "=" ]; then prev="${COMP_WORDS[COMP_CWORD-2]}"; prevWasEq=true;
else prev="${COMP_WORDS[COMP_CWORD-1]}"
fi
# current completion is double quoted add a space so the curor progresses
if [[ "$2" == \"*\" ]]; then
COMPREPLY=( "$cur " );
return;
fi
case "$COMP_CWORD" in
1)
case "${COMP_WORDS[1]}" in
-e | --help | --version) return 0 ;;
--*) _handleConfig ;;
*) mapfile -t COMPREPLY < <( compgen -W "${topLevel}" -- "$cur" ); addSpaces ;;
esac
;;
*)
case "$prev" in
-e | --help | --version) return 0 ;;
*)
if [[ "=" != "${COMP_WORDS[COMP_CWORD]}" && $prevWasEq != true ]]; then
# must be completing with a space after the key eg: '--<key> '
# clear out prev so we don't run any of the key specific completions
prev=""
fi
case "${COMP_WORDS[1]}" in
--*) _handleConfig ;;
+*) _handleActions ;;
esac
;;
esac
;;
esac
return 0
}
complete -o nospace -o bashdefault -F _ghostty ghostty
```
</details>
cc @jparise
I agree to re-license my commits to MIT
Closes #2053
2024-12-15 18:14:56 -08:00
Jeffrey C. Ollie
0c6f4afb34
fix sprite drawing test
2024-12-15 18:00:50 -06:00
Jeffrey C. Ollie
3588d81dcb
simplify the code for separated block quadrants
2024-12-15 17:59:04 -06:00
Mitchell Hashimoto
f50e8a5fdb
Add new font adjust configs ( #2962 )
...
Add keys for adjusting overline position/thickness and box drawing
thickness, + docs to each adjust key clarifying what the metric they
adjust does.
2024-12-15 14:09:30 -08:00
Mitchell Hashimoto
fdd330d22d
apprt/gtk: stylistic changes
2024-12-15 14:01:10 -08:00
Tristan Partin
98380f3c42
apprt/gtk: abstract AdwHeaderBar and GtkHeaderBar
...
This will make further changes a little bit more readable.
Signed-off-by: Tristan Partin <tristan@partin.io>
2024-12-15 14:01:10 -08:00
Mitchell Hashimoto
09b7c7b617
apprt/gtk: add gtk-tabs-location=hidden ( #2729 )
...
This is only supported on libadwaita. Instead of the normal tab overview
button, we will use an AdwTabButton[0].
Link:
https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.6/class.TabButton.html
[0]
2024-12-15 13:54:30 -08:00
Mitchell Hashimoto
fc6357ac70
apprt/gtk: slight style feedback
2024-12-15 13:54:06 -08:00
Anund
79d2f508a9
bash: support short form boolean options
2024-12-16 08:23:28 +11:00
Anund
f1728f594a
bash: remove quoted completions while sorting possible portability issue
2024-12-16 08:22:42 +11:00
Jeffrey C. Ollie
d0677928af
font: add sprites for the separated block quadrants
...
Unicode 16 added "Separated Block Quadrants" from CP 0x0x1CC21 through 0x1CC2F:
To test, use the following command:
```
printf "\U0001CC21\U0001CC22\U0001CC23\U0001CC24\U0001CC25\U0001CC26\U0001CC27\U0001CC28\U0001CC29\U0001CC2A\U0001CC2B\U0001CC2C\U0001CC2D\U0001CC2E\U0001CC2F\n"
```
2024-12-15 14:33:09 -06:00
Anund
ea181579df
bash: add _files and _dirs to correctly add spaces to only the final result
2024-12-16 01:32:51 +11:00
Anund
361967f721
bash: formatting changes, change to reference binary name via variable
2024-12-16 01:32:50 +11:00
Anund
c02789205e
bash: fix incorrect completion for '--key '
2024-12-16 01:32:46 +11:00
deftdawg
9117842a45
Merge branch 'ghostty-org:main' into alt-keybindings-copy-and-paste
2024-12-15 00:21:20 -05:00
Jon Parise
a0ce70651a
bash: re-enable automatic bash shell detection
...
Bash shell detection was originally disabled in #1823 due to problems
with /bin/bash on macOS.
Apple distributes their own patched version of Bash 3.2 on macOS that
disables the POSIX-style $ENV-based startup path:
e5397a7e74/bash-3.2/shell.c (L1112-L1114)
This means we're unable to perform our automatic shell integration
sequence in this specific environment. Standard Bash 3.2 works fine.
Knowing this, we can re-enable bash shell detection by default unless
we're running "/bin/bash" on Darwin. We can safely assume that's the
unsupported Bash executable because /bin is non-writable on modern macOS
installations due to System Integrity Protection.
macOS users can either manually source our shell integration script
(which otherwise works fine with Apple's Bash) or install a standard
version of Bash from Homebrew or elsewhere.
2024-12-14 17:31:28 -05:00
Tristan Partin
06ba06cfd0
apprt/gtk: unify tooltip text with AdwTabButton
...
AdwTabButton uses "View Open Tabs."
Signed-off-by: Tristan Partin <tristan@partin.io>
2024-12-14 12:40:11 -06:00
Tristan Partin
73bb2bb9bc
apprt/gtk: add gtk-tabs-location=hidden
...
This is only supported on libadwaita. Instead of the normal tab overview
button, we will use an AdwTabButton[0].
Link: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.6/class.TabButton.html [0]
Signed-off-by: Tristan Partin <tristan@partin.io>
2024-12-14 12:40:11 -06:00
Anund
fddc880941
bash: add bash completion generation
...
closes #2053
2024-12-15 02:37:12 +11:00
Anund
5195042f96
zsh: add -e completion, fix incorrectly copied sed expression
...
skip +version +help to keep completions the same across bash/zsh/fish
2024-12-15 02:06:16 +11:00
Anund
71aec52b8c
fish: raise eval quota inline with other completions, add -e
2024-12-15 01:28:52 +11:00