122 Commits

Author SHA1 Message Date
Anund
c7deea6a7f zsh: add completions generation 2024-12-11 21:11:38 +11:00
Mitchell Hashimoto
5b01cb353d config: need to dupe filepath for diagnostics
Fixes #2800

The source string with the filepath is not guaranteed to exist beyond
the lifetime of the parse operation. We must copy it.
2024-11-27 08:46:47 -08:00
Mitchell Hashimoto
2e939b617e config: clone should copy diagnostics
Fixes #2800
2024-11-26 15:13:32 -08:00
Mitchell Hashimoto
4ef2240618 cli: parseCLI for optionals should not be null in release modes
Fixes #2747

I admit I don't fully understand this. But somehow, doing `var x: ?T =
undefined` in release fast mode makes `x` act as if its unset. I am
guessing since undefined does nothing to the memory, the memory layout
is such that it looks null for zeroed stack memory. This is a guess.

To fix this, I now initialize the type `T` and set it onto the optional
later. This commit also fixes an issue where calling `parseCLI` multiple
times on an optional would not modify the previous value if set.
2024-11-20 19:05:52 -08:00
Mitchell Hashimoto
7d2dee2bc3 cli: parseCLI form works with optionals 2024-11-19 11:05:20 -08:00
Mitchell Hashimoto
d2cdc4f717 cli: parse auto structs 2024-11-19 10:46:25 -08:00
furtidev
8901027e6d fix: theme search ranking is now case insensitive 2024-11-16 20:05:11 +06:00
furtidev
fb2510c2ed fix: +list-themes crashing when there's search result is empty 2024-11-16 20:03:58 +06:00
furtidev
a6bdd2f201 port +list-themes to latest libvaxis 2024-11-16 20:02:35 +06:00
furtidev
e7b9a2ac95 port +list-keybinds to latest libvaxis 2024-11-16 19:39:48 +06:00
Mitchell Hashimoto
bb60190630 update zf api 2024-11-12 19:15:25 -08:00
Mitchell Hashimoto
72659d48ac Merge pull request #2637 from jcollie/core-list-valid-enums
core: list valid options if an invalid value is detected parsing an enum
2024-11-09 11:57:10 -08:00
Mitchell Hashimoto
8b2980284d Merge pull request #2636 from jcollie/unifi-adwaita
core/gtk: unify libadwaita/adwaita options in the code
2024-11-09 11:56:58 -08:00
Jeffrey C. Ollie
3eef6d205e core: address review comments
- break formatting values out into a function so that we can
  catch errors and never fail
- eliminate the use of toOwnedSentinelSlice since we are using
  an arena to clean up memory
2024-11-09 12:49:40 -06:00
Pepper Lebeck-Jobe
3c493f2d0d Fix copying the theme name
Prior to this change both C and c would copy the path to the theme even though
the help screen claimed that c would copy the theme name.

There is a bug in libvaxis that results in both of these matches matching c:
  `key.matches('c', .{})`
	`key.matches('c', .{ .shift = true })`

Tested:
  Before the change: 'c' copies path and 'C' copies path
  After the change: 'c' copies the name and 'C' copies the path
2024-11-09 10:10:29 +01:00
Jeffrey C. Ollie
ca844ca3c0 core: list valid options if an invalid value is detected parsing an enum 2024-11-08 22:32:14 -06:00
Jeffrey C. Ollie
b353ddf46d core/gtk: unify libadwaita/adwaita options in the code
Fixes #2574
2024-11-08 22:19:04 -06:00
Mitchell Hashimoto
b11b5871e9 cli: do not parse actions (+command) after -e
Fixes #2506
2024-10-30 20:56:53 -04:00
Anmol Wadhwani
70d850f8e4 make selection a const 2024-10-27 21:40:25 +05:30
Anmol Wadhwani
9190dd3ad7 Add an out of bounds check for mouse-selected themes in +list-themes 2024-10-27 20:51:21 +05:30
Mitchell Hashimoto
fc6eda6623 cli: +help needs to use the proper args iterator 2024-10-19 10:43:08 -07:00
Mitchell Hashimoto
c90ed29341 cli: skip argv0 and actions when parsing CLI flags
This fixes a regression from #2454. In that PR, we added an error when
positional arguments are detected. I believe that's correct, but we
were silently relying on the previous behavior in the CLI commands.

This commit changes the CLI commands to use a new argsIterator function
that creates an iterator that skips the first argument (argv0). This is
the same behavior that the config parsing does and now uses this shared
logic.

This also makes it so the argsIterator ignores actions (`+things`)
and we document that we expect those to be handled earlier.
2024-10-18 12:59:16 -07:00
Mitchell Hashimoto
940a46d41f cli: positional arguments are invalid when parsing configuration 2024-10-18 08:11:11 -07:00
Mitchell Hashimoto
4e25840e08 apprt/gtk: support new config diagnostics API 2024-10-18 08:11:11 -07:00
Mitchell Hashimoto
70c175e2a6 c: remove the config load string API
It was unused and doesn't match our diagnostic API.
2024-10-18 08:11:11 -07:00
Mitchell Hashimoto
a12b33662c config: track the location of CLI argument errors 2024-10-18 08:11:11 -07:00
Mitchell Hashimoto
f24098cbd8 config: show filepath and line numbers for config errors
Fixes #1063
2024-10-18 08:11:11 -07:00
Mitchell Hashimoto
a4e14631ef config: richer diagnostics for errors
Rather than storing a list of errors we now store a list of
"diagnostics." Each diagnostic has a richer set of structured
information, including a message, a key, the location where it occurred.

This lets us show more detailed messages, more human friendly messages, and
also let's us filter by key or location. We don't take advantage of
all of this capability in this initial commit, but we do use every field
for something.
2024-10-18 08:11:11 -07:00
Rick Calixte
d0316b746d list_fonts and list_keybinds: Fix typos in documentation
test.yml: Switch to Windows Server 2022 and update Zig URL
2024-10-16 22:56:16 -04:00
Jeffrey C. Ollie
f645d6962b cli: add GTK & libadwaita version info
If the apprt is GTK add the GTK and the libadwaita version info to the
`+version` action. This information is available in the log but it may
be more accessible here.
2024-10-15 14:48:34 -05:00
Mitchell Hashimoto
ed2cd6d436 macos: remove the ability to bind fn/globe
This was recently introduced a few days ago. Unfortunately, this doesn't
work as expected. The "function" modifier is not actually the fn key
but used by macOS to represent a variety of "functional" key presses.
This breaks other bindings such as #2411.

I can't find a source on the internet that reliably tells me how we
can detect fn key presses, but I do find a number of sources that tell
us we can't.
2024-10-07 14:36:12 -10:00
Mitchell Hashimoto
e9f1fe327f cli/list-keybinds: output function modifier 2024-10-05 10:13:39 -10:00
Paul Berg
aa10e5160b cli: handle mouse scroll before setting window 2024-09-30 11:02:32 +02:00
Jeffrey C. Ollie
9f543ceac2 cli: fix integer overflow in +list-themes if window is too narrow
Reproduction is to resize the window to it's minimum width and then
run `ghostty +list-themes`. Ghostty will crash because Zig for loops
don't like having a range where the end is smaller than the start.
2024-09-28 12:12:00 -05:00
Jeffrey C. Ollie
a969364f93 cli/list-themes: add ability to search theme names 2024-09-27 10:53:58 -07:00
Jeffrey C. Ollie
e313352c1f cli: update +list-themes --help text 2024-09-27 10:53:58 -07:00
Jeffrey C. Ollie
a6a4f9ff8e cli: list-themes should list symlinks
Symbolic links should be listed in addition to normal files. Useful
for system like home-manager that link config files to location in the
Nix store.
2024-09-27 10:53:58 -07:00
Jeffrey C. Ollie
743e547235 cli: "fancy" theme preview
This adds a "fancy" theme preview to the `+list-themes` CLI action.
By default, if the command is connected to a TTY, it will display the
fancy preview. If it is not connected to a TTY, or the user specifies
`--plain` on the command line, a simple list of themes will be printed
to stdout.

While in the preview `F1` or `?` will show a help screen.
2024-09-27 10:53:58 -07:00
Mitchell Hashimoto
66143a33ef input: move flags to a packed struct 2024-09-23 14:03:53 -07:00
Mitchell Hashimoto
a389987ada cli: config structure supports tagged unions
The syntax of tagged unions is `tag:value`. This matches the tagged
union parsing syntax for keybindings (i.e. `new_split:right`).

I'm adding this now on its own without a user-facing feature because
I can see some places we might use this and I want to separate this out.
There is already a PR open now that can utilize this (#2231).
2024-09-16 15:53:59 -07:00
Mitchell Hashimoto
11c3ca69f5 cli/crash-report: make it simpler (uglier, honestly) 2024-09-10 21:15:40 -07:00
Jeffrey C. Ollie
6292cdec0e remove unnecessary imports 2024-09-10 20:43:00 -07:00
Jeffrey C. Ollie
d907cebae9 feat: basic +crash-report cli action
Only lists crash reports right now. Viewing and/or submitting crash
reports to come later.
2024-09-10 20:43:00 -07:00
xdBronch
b748ae6c0f make +version hyperlink to the github commit 2024-09-02 18:48:49 -07:00
Mitchell Hashimoto
f1aea10a84 cli/version: don't parse any args
Fixes #2166
2024-08-31 10:39:22 -07:00
Mitchell Hashimoto
7dfad49e40 input: converting set entries to Entry from Action 2024-08-18 20:30:32 -07:00
Jeffrey C. Ollie
7de692c955 themes: don't use arena directly and cleanup debug code 2024-08-18 19:20:42 -07:00
Jeffrey C. Ollie
8c4cfc3bbb themes: finish refactor 2024-08-18 19:20:42 -07:00
Jeffrey C. Ollie
87791ed562 themes: add a switch that shows a small preview of each theme 2024-08-18 19:20:42 -07:00
Jeffrey C. Ollie
7a11b22c5f themes: allow loading from absolute paths and from user config dir 2024-08-18 19:20:42 -07:00