4129 Commits

Author SHA1 Message Date
Mitchell Hashimoto
ff68c56268 pkg/macos: implement CTRun 2023-12-11 11:12:28 -08:00
Mitchell Hashimoto
554d2d0185 Merge pull request #1048 from mitchellh/combining
font: position combining character correctly on x-axis
2023-12-11 07:56:12 -08:00
Mitchell Hashimoto
3e9a6e4de5 renderer/opengl: apply extra offset for zero-advance glyphs 2023-12-10 17:10:00 -08:00
Mitchell Hashimoto
5e9ddb5e65 renderer/metal: offset zero-advance glyphs by the cell width 2023-12-10 17:08:32 -08:00
Mitchell Hashimoto
3fdb6a496d font/coretext: calculate advance_x properly 2023-12-10 17:08:20 -08:00
Mitchell Hashimoto
39b15a13b4 Merge pull request #1045 from mitchellh/macos-tab
macos: previous_tab/next_tab wraps
2023-12-10 15:13:40 -08:00
Mitchell Hashimoto
45a4573991 macos: previous_tab/next_tab wraps
Fixes #999
2023-12-10 15:12:22 -08:00
Mitchell Hashimoto
9bd8aa3cce Merge pull request #1044 from mitchellh/keybind-clear
config: keybind = clear clears unmaps all keybinds
2023-12-10 14:25:50 -08:00
Mitchell Hashimoto
715782b60f config: keybind = clear clears unmaps all keybinds
Fixes #1033

This introduces `keybind = clear` which will unmap all keybindings set
up to that point (including defaults).
2023-12-10 13:57:14 -08:00
Mitchell Hashimoto
85f69a5ba5 Merge pull request #1043 from mitchellh/kitty-replace
renderer/metal,opengl: replace matching image IDs if transmit time differs
2023-12-10 09:22:32 -08:00
Mitchell Hashimoto
0b60ae0010 renderer/metal,opengl: replace matching image IDs if transmit time differs
Fixes #1037

Renderers must convert the internal Kitty graphics state to a GPU
texture for rendering. For performance reasons, renderers cache the GPU
state by image ID. Unfortunately, this meant that if an image was
replaced with the same ID and was already cached, it would never be
updated on the GPU.

This PR adds the transmission time to the cache. If the transmission
time differs, we assume the image changed and replace the image.
2023-12-10 09:16:10 -08:00
Mitchell Hashimoto
d51614d319 Merge pull request #1042 from kai-tub/main
doc: Update `gtk-titlebar` documentation
2023-12-10 06:36:01 -08:00
Kai Norman Clasen
b46fd01c4e doc: Update gtk-titlebar documentation
Mention that changes to `gtk-titlebar` only
affects new windows.
2023-12-10 13:35:06 +01:00
Mitchell Hashimoto
3c8b6e8bd7 Merge pull request #1038 from mitchellh/caioaao/fix-build-zig-nightly
Remove redundant `inline` key
2023-12-09 15:13:56 -08:00
Caio Oliveira
e17427f0c7 Remove redundant inline key
This breaks in zig version `0.12.0-dev.1808+69195d0cd` (current head)
2023-12-09 20:03:26 -03:00
Mitchell Hashimoto
c20ce263eb Merge pull request #1036 from mitchellh/resize
terminal: resize to less rows with empty lines should trim lines
2023-12-09 14:38:15 -08:00
Mitchell Hashimoto
b327aab3d0 terminal: resize to less rows with empty lines should trim lines
Fixes #1030
2023-12-09 14:30:54 -08:00
RGBCube
7154214062 Merge pull request #1035 from NReilingh/NReilingh-patch-1
README.md: Fix broken link to devShell.nix file
2023-12-10 00:33:12 +03:00
Nick Reilingh
78b16d542a README.md: Fix broken link to devShell.nix 2023-12-09 15:49:40 -05:00
Mitchell Hashimoto
43f7fc92e9 Merge pull request #1031 from mitchellh/gtk-unshifted
apprt/gtk: use map_keycode to get the proper unshifted key for a layout
2023-12-08 21:03:04 -08:00
Mitchell Hashimoto
08f2e91ff5 apprt/gtk: use map_keycode to get the proper unshifted key for a layout
Fixes #1014

There were a couple overlapping issues here:

  1. To determine the "unshifted" key, we were using `keyval_to_lower`.
     This only works if the key is uppercase and not all layouts are
     uppercase for the unshifted value.

  2. If we couldn't case the unicode value of a key or unshifted key to
     ASCII, we'd say the key was the same as the physical key. This is
     incorrect because the physical key is always the layout of the
     physical keyboard so for example with the Turkish layout on a US
     keyboard, you'd get US letters when a key may only correspond to
     non-US letters.

To fix the first issue, we are using map_keycode to map the hardware
keycode to all possible keyvals from it. We then use the currently
active layout to find the unshifted value.

To fix the scond issue, we no longer fallback to the physical key if
there was IM text or non-ASCII unicode values for the key.

I tested Turkish with #1014 and I tested Dvorak to make sure those
basics still work.
2023-12-08 20:41:09 -08:00
Mitchell Hashimoto
201d5da768 Merge pull request #1027 from vancluever/vancluever-nix-update-zig-012
nix: Update nixpkgs-zig-0-12 source
2023-12-08 16:19:01 -08:00
Chris Marchesi
42c307ef2a nix: Update nixpkgs-zig-0-12 source
With the nixpkgs LLVM 17 PR (NixOS/nixpkgs#258614) now merged, we can
update this flake input to base off of master so that we can take
advantage of the built LLVM derivation when it's ready.

This only leaves Zig 0.12 which should mean a much reduced build time.

Note that of this writing, the derivations are still queued, so until
that happens, this update means a rebuild of LLVM 17 for anyone using
the ghostty package.
2023-12-08 14:51:04 -08:00
Mitchell Hashimoto
ec989d6b46 macos: newTab needs to call Controller.showWindow 2023-12-08 08:46:05 -08:00
Mitchell Hashimoto
2061acddc9 Merge pull request #1001 from vancluever/vancluever-powerline-half-circles
Powerline: Add half-circle rendering
2023-12-08 08:16:55 -08:00
Mitchell Hashimoto
d3ccca7c54 Merge pull request #1022 from watura/chore/update-mac-icon
macos: use images/icons for mac app icons
2023-12-08 08:15:08 -08:00
Mitchell Hashimoto
0c8883c07e ci: remove garnix for now, we may add it back later 2023-12-08 08:14:05 -08:00
Mitchell Hashimoto
6573a48fa3 Merge pull request #1025 from RGBCube/main
Clean up Nix code, WIP: Create checks in Nix and package for Darwin
2023-12-08 08:03:19 -08:00
Mitchell Hashimoto
ee26d48140 nix: add back shell.nix 2023-12-08 07:59:19 -08:00
Mitchell Hashimoto
24c64d4b44 nix: make devshell platform-specific 2023-12-08 07:58:52 -08:00
Mitchell Hashimoto
83f434df50 Merge pull request #1023 from mitchellh/macos-fs
macos: manually show window to handle mission control behavior
2023-12-08 07:36:55 -08:00
Mitchell Hashimoto
cc74a8e467 Merge pull request #1024 from mattrobenolt/make-clean
meta: add make clean task
2023-12-08 07:35:58 -08:00
Mitchell Hashimoto
f7f29f8b29 Merge pull request #1021 from vancluever/vancluever-selection-mirror
Selection: fix bottom-right/top-left rectangle selections
2023-12-08 07:35:27 -08:00
RGBCube
b3082e3925 Use camelCase for all nix files 2023-12-08 16:53:02 +03:00
RGBCube
0e941896fa Compile wraptest with O3, run hooks 2023-12-08 16:53:02 +03:00
RGBCube
5846d991e9 Add garnix cache and clean up all nix code 2023-12-08 16:52:58 +03:00
Mitchell Hashimoto
54e7f13f14 remove new-window action from desktop file
Fixes #1006
2023-12-08 16:38:20 +03:00
Chris Marchesi
df142e08ad Selection: fix bottom-right/top-left rectangle selections
This fixes an issue where selections from the bottom-right to the
top-left (or top-left to bottom-right), in addition to some single-line
rectangle selections, were not working.

This works by handling situations where only one of the x or y
axes in the start or end points may need to be flipped to get the
correct top-left or bottom-right of a selection. We call these kinds of
orientations "mirrored", like you were looking in a mirror.

This also adds a small bit of logic that keeps these kinds of motions in
rectangle selection from selecting the character before or after it.
This has the current side-effect of anchoring a rectangle selection to
the original characters if you change directions during the selection,
something I will look at in a later commit.

Finally, this also removes rectangle select on double-click. I thought
this might be a good idea, but word select in rectangle mode really
does not work (the effect seems pretty erratic), and it's not
implemented in Kitty either.

Fixes #1008.
2023-12-07 23:51:37 -08:00
Matt Robenolt
d9725f645a meta: add make clean task 2023-12-07 23:07:51 -08:00
Mitchell Hashimoto
4b25356625 macos: manually show window to handle mission control behavior
Fixes #1018
Fixes #1020

This disables the "visibleAtLaunch" configuration in the xib and
manually shows the window when it loads. This lets us carefully control
what happens particularly when a window is full screen (native) and part
of Mission Control.

Previously, the behavior depended on the Settings.app "Prefer tabs
when opening documents" setting, but we didn't handle every behavior
correctly (see #1018 and #1020). I couldn't find a way to robustly
handle all cases because there are no published macOS APIs for
interacting with Mission Control...

Plus, terminals aren't really "documents" so it did confuse at least one
user that Ghostty would follow this configuration. We just incidently
did because we use native tabbing.

This PR takes full control into our own hands. Our behavior is now:

  - If a new window is created from a native fullscreen window, the
    new window is created into native fullscreen.

  - If a new tab is created from a native fullscreen window, the
    tab is added to the existing window and does not create a new space.

  - If a window or tab is created from a non-fullscreen window, the
    existing behaviors remain.
2023-12-07 22:44:47 -08:00
Chris Marchesi
d34b5571d8 Powerline: Add half-circle rendering
This adds in-terminal rendering for the powerline glyphs E0B4 and E0B6,
similar to how we are rendering the triangle shapes currently.

The circle glyphs use a much more complex rendering due to the nuances
of drawing them: we use a midpoint algorithm for drawing on a 4x
supersampled matrix, fill, and then downsample. We use the same
downsampling approach as is done in the arc box drawing code.

The midpoint variant we're using here is described by Dennis Yurichev:
https://yurichev.com/news/20220322_circle/, although there are similar
variants elsewhere (some cited at the bottom of his article).
2023-12-07 22:29:59 -08:00
Wataru Nishimoto
5979bcb74a use images/icons for mac app icons 2023-12-08 14:56:51 +09:00
Mitchell Hashimoto
9b81d57cb9 remove new-window action from desktop file
Fixes #1006
2023-12-07 20:46:05 -08:00
Mitchell Hashimoto
fcbd3ac4de Merge pull request #1019 from mitchellh/underline-palette
terminal: support `58;5` for setting underline color via 256 palette
2023-12-07 15:04:26 -08:00
Mitchell Hashimoto
84a0e4e62d terminal: support 58;5 for setting underline color via 256 palette
Fixes #1013
2023-12-07 14:57:07 -08:00
Mitchell Hashimoto
3f76094d84 macos: handle the "+" button automatically adding the window to the tabs
Fixes #1010
2023-12-07 14:39:54 -08:00
Mitchell Hashimoto
6c285e1a3d Merge pull request #1015 from mitchellh/macos-tab-order
macos: new tab button creates new tab after short delay
2023-12-07 12:42:15 -08:00
Mitchell Hashimoto
fc6def01a1 macos: new tab button creates new tab after short delay
Fixes #1010

I can't explain this. See the comment in the diff.
2023-12-07 12:35:19 -08:00
Mitchell Hashimoto
5057b1bf76 Merge pull request #1012 from mitchellh/close-keybinding
core: detect inputs that result in surface close and avoid segfault
2023-12-07 10:39:32 -08:00
Mitchell Hashimoto
9de5d991a2 core: detect inputs that result in surface close and avoid segfault
Fixes #965

When processing keybindings that closed the surface (`close_surface`,
`close_window`), the surface and associated runtime structures would be
freed so we could segfault.

This PR introduces a new enum result for input events (only key for now)
that returns whether an event resulted in a close. In this case, callers
can properly return immediately and avoid writing to deallocated memory.
2023-12-07 10:24:39 -08:00