This
$10/bar.txt
was partially matching but should not match at all.
This commit fixes this by simply `[\w]` to `[A-Za-z_]` as the first
character of a bare relative path, so digit-starting fragments can't
match.
Another option would be a lookbehind but I think the check above is much
simpler.
A string like this
foo/$BAR/baz
should match fully, not partially.
This commit fixes this by expanding `\$[A-Za-z_]\w*\/` to
`(?:[\w][\w\-.]*\/)*\$[A-Za-z_]\w*\/` in rooted_or_relative_path_prefix
so that we optionally eat everything before a variable `$VAR/`.
Strings like
$10/$20
Should not match.
This commit fixes this by narrowing `\w` after `$` to `[A-Za-z_]` which
is— according to Google Gemini— what environment variables can start
with.
A string like
foo.local/share
should match fully, not partially.
This commit fixes this by moving `dotted_path_lookahead` before
`bare_relative_path_prefix` so the dot-check scans the entire match
rather than only the text after it.
Related to #1972
This commit adds three new alternatives for
`rooted_or_relative_path_prefix`:
- `~/`
- `$VAR` and
- `.local/`, `.config/` etc. for dot-prefixed directory names
Related to #1972
Fixes an issue when paths have embedded comma, e.g.:
shared/src/foo/SomeItem.m:12, shared/src/
with path_chars greedily consuming the rest of the string.
Now file path matching stops at comma. Scheme URLs are unchanged and
still using the comma.
Break up the big monolithic URL and path regex into named sub-pattern
constants and compose the final expression from three commented
branches:
- URLs with a scheme
- absolute or dot-relative paths
- bare relative paths
This commit only breaks up the regex. It keeps the existing matching
behavior unchanged.
The previous logic didn't detect the `e` option when it was combined
with other flags (e.g. `-ie`). This change also attempts to improve the
general readability of this code to be a bit more explicit.
bash-preexec implements support for its "precmd" and "preexec" hooks
using a combination of PROMPT_COMMAND and a DEBUG trap. The latter is
unfortunately quick slow (in a relative sense), and the overall system
is a bit more generalized than what we need for our shell integration
(e.g. supporting multiple function hooks, subshells, etc.).
Bash 4.4 introduced the PS0 variable, which is expanded and displayed by
interactive shells after reading a complete command but before executing
it. This is all we need to implement our own shell integration hooks.
In Bash 5.1, PROMPT_COMMAND can be an array variable, each element of
which can contain a command to be executed like a string PROMPT_COMMAND
variable. When adding our hook to PROMPT_COMMAND, we preserve its type
(string or array) to be minimally intrusive. This also matches direnv's
approach.
Bash 5.3 introduced support for function substitution, which is an even
more efficient way to run code from PS0, so we use that when available.
Otherwise, we use the more traditional command substitution approach.
Earlier versions of bash (such as 3.2, which still ships with macOS)
continue to use the bash-preexec path. This gives us two code paths to
maintain, but I think that's preferable to fully maintaining our own
DEBUG trap-based system for older bash versions given that bash-preexec
has proven to work reliably in those environments. We also wouldn't
unlock any other user benefits aside from removing the bash-preexec
script dependency.
See: #3724, #7734
uses the `final` fixed point package set as the source of dependencies
for the ghostty package created by the overlay - allows simpler
overriding of dependencies when using the overlay
no AI used
updates nixpkgs and home-manager
X11 packages are now not in a shared namespace
the ZIG_GLOBAL_CACHE_DIR creation was moved to the configurePhase in the
zig hook
moves nix shell from #devShell.\<system\> to
#devshells.\<system\>.default
tested with `nix run` and `nix flake check` on x86-64_linux
no AI used
According to the [Contributors' Guides for
I18n](https://github.com/ghostty-org/ghostty/blob/main/po/README_CONTRIBUTORS.md):
> This file must stay in sync with the list of translatable strings
present in source code or Blueprints at all times. A CI action would be
run for every PR, which checks if the translation template requires any
updates.
Currently, the CI passes even if the POT file is outdated and has not
been updated for a long time. Add `set -euxo pipefail` to
`check-translations.sh` to ensure the CI fails when contributors do not
update the POT file with their changes.
Before:
```
❯ bash .github/scripts/check-translations.sh; echo "status code: $?"
po/com.mitchellh.ghostty.pot:87: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:91: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:95: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:99: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:103: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:110: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:114: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:126: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:297: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:301: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
po/com.mitchellh.ghostty.pot:305: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.YxAlAg28KW
msgcmp: found 11 fatal errors
status code: 0
```
After:
```
❯ bash .github/scripts/check-translations.sh; echo "status code: $?"
++ mktemp
+ old_pot=/var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
+ cp po/com.mitchellh.ghostty.pot /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
+ zig build update-translations
+ msgcmp /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR po/com.mitchellh.ghostty.pot --use-untranslated
po/com.mitchellh.ghostty.pot:87: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:91: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:95: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:99: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:103: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:110: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:114: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:126: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:297: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:301: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
po/com.mitchellh.ghostty.pot:305: this message is used but not defined in /var/folders/sq/_thdhjtd653cbg8c_8_4r6mc0000gn/T/tmp.OfLyQ8IKsR
msgcmp: found 11 fatal errors
status code: 1
```
PROMPT_COMMAND array support for introduced in bash 5.1, and it's the
preferred format moving forward. Using the string form is also fine, but
it's easy to be a modern bash citizen here, so let's do so.
Add `set -euxo pipefail` to `check-translations.sh` to ensure the CI
fails when contributors do not update the POT file with their changes.
Currently, the CI passes even if the POT file is outdated and the POT
has not been updated for a long time.
bash-preexec implements support for its "precmd" and "preexec" hooks
using a combination of PROMPT_COMMAND and a DEBUG trap. The latter is
unfortunately quick slow (in a relative sense), and the overall system
is a bit more generalized than what we need for our shell integration
(e.g. supporting multiple function hooks, subshells, etc.).
Bash 4.4 introduced the PS0 variable, which is expanded and displayed by
interactive shells after reading a complete command but before executing
it. This is all we need to implement our own shell integration hooks.
In Bash 5.1, PROMPT_COMMAND can be an array variable, each element of
which can contain a command to be executed like a string PROMPT_COMMAND
variable. When adding our hook to PROMPT_COMMAND, we preserve its type
(string or array) to be minimally intrusive. This also matches direnv's
approach.
Bash 5.3 introduced support for function substitution, which is an even
more efficient way to run code from PS0, so we use that when available.
Otherwise, we use the more traditional command substitution approach.
Earlier versions of bash (such as 3.2, which still ships with macOS)
continue to use the bash-preexec path. This gives us two code paths to
maintain, but I think that's preferable to fully maintaining our own
DEBUG trap-based system for older bash versions given that bash-preexec
has proven to work reliably in those environments. We also wouldn't
unlock any other user benefits aside from removing the bash-preexec
script dependency.
See: #3724, #7734