3716 Commits

Author SHA1 Message Date
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
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
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
b327aab3d0 terminal: resize to less rows with empty lines should trim lines
Fixes #1030
2023-12-09 14:30:54 -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
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
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
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
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
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
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
Mitchell Hashimoto
219aa3a156 Merge pull request #990 from mitchellh/mrn/gtk-resize-splits
gtk: add support for resizing splits via keybinds
2023-12-06 20:53:45 -08:00
Mitchell Hashimoto
3c4bd47de3 apprt/gtk: stylistic changes 2023-12-06 20:53:32 -08:00
Mitchell Hashimoto
29312e76e5 core: mods change doesn't unhide mouse
Fixes #989
2023-12-06 11:38:26 -08:00
Mitchell Hashimoto
fe3b12c1b4 font: use nerd font patched jetbrains font
Fixes #996
2023-12-06 11:20:07 -08:00
Mitchell Hashimoto
5ef7fd1dc8 Merge pull request #995 from mitchellh/macos-preedit-bs
macos: if a preedit state is cleared, don't send key event
2023-12-06 09:06:12 -08:00
Mitchell Hashimoto
7ea0dfdd5d macos: if a preedit state is cleared, don't send key event
Fixes #992
2023-12-06 09:04:59 -08:00
Carlos Alexandro Becker
25856d62aa Remove FiraCode leftovers
from #993

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-12-06 13:36:05 -03:00
Mitchell Hashimoto
55ba15fe66 change default embedded font to JetBrains Mono
Fixes #991

This changes the default embedded font from Fira to JetBrains Mono. This
only affects users who don't specify or font AND Ghostty can't find
another default font to use on their system.

This is one part an aesthetic choice: I've grown to personally like
JetBrains Mono more than Fira, and I think I have the right to change
the defaults ;)

But this is also partly because of #991: FiraCode contains glyphs for
symbolic ranges. This may not be Fira official... I think I may have
used a Nerd font patched one and that may be the issue. So I don't want
to blame the Fira font project. BUT, we have to replace the ttf in our
project and since I've been meaning to switch to JB Mono I just did that
now.
2023-12-06 08:08:14 -08:00
Thorsten Ball
40e239bf7a gtk: add support for resizing splits via keybinds
This adds support for resizing splits via keybinds to the GTK runtime.

Code is straightforward. I couldn't see a way to do it without keeping
track of the orientation of the splits, but I think that's fine.
2023-12-06 06:25:34 +01:00
Mitchell Hashimoto
534de78d37 core: alternate scroll encoding should respect DECCKM 2023-12-05 09:43:53 -08:00
Tim Culverhouse
c9f2f806ec terminal: implement mode 1047 (alternate screen)
Implement handling of mode 1047, which enters the alternate screen. This
is not used often, typically applications will favor 1049 (enter alt
screen, save cursor, clear alt screen).
2023-12-05 10:37:11 -06:00
Mitchell Hashimoto
0fc6076ee5 renderer: default codepoints for preedit 2023-12-03 20:28:28 -08:00
Mitchell Hashimoto
56c6c096fa renderer: handle scenarios the preedit text is wider than our screen 2023-12-03 20:16:49 -08:00
Mitchell Hashimoto
0cdefe8b8b core: remove size limit on preedit length by heap allocating
Fixes #882

We previously had a hardcoded limit of 16 codepoints. In #882, a user
pointed out that in Chinese, is reasonable for a preedit input to be
longer than this.

To avoid any future issues, this commit moves to a heap-allocated
variant. Preedits aren't that common, they aren't high throughput, and
they're generally pretty small, so using a heap allocation is fine. The
memory is owned by the person who set it.
2023-12-03 19:54:26 -08:00
Mitchell Hashimoto
7f40881747 font: faces use primary grid metrics to better line up glyphs
Fixes #895

Every loaded font face calculates metrics for itself. One of the
important metrics is the baseline to "sit" the glyph on top of. Prior to
this commit, each rasterized glyph would sit on its own calculated
baseline. However, this leads to off-center rendering when the font
being rasterized isn't the font that defines the terminal grid.

This commit passes in the font metrics for the font defining the
terminal grid to all font rasterization requests. This can then be used
by non-primary fonts to sit the glyph according to the primary grid.
2023-12-02 09:51:15 -08:00
Mitchell Hashimoto
62d69e95a5 config: improve docs for minimum-contrast 2023-12-01 22:09:52 -08:00
Mitchell Hashimoto
ec8f3d036e renderer/opengl: implement min contrast 2023-12-01 21:55:51 -08:00
Mitchell Hashimoto
e3eba92c0e renderer/metal: only apply min contrast if set and only on non-color fg 2023-12-01 21:26:33 -08:00
Mitchell Hashimoto
7af4009f27 renderer/metal: minimum contrast ratio is configurable 2023-12-01 21:24:38 -08:00
Mitchell Hashimoto
6c859cca82 renderer/metal: minimum contrast experiment
This uses WCAG2 algorithms with a minimum ratio hardcoded of 3:1. This
is not shippable in its current state because we want the ratio to be
configurable and I'm not happy with the way data is being sent to the
shader.
2023-12-01 20:51:16 -08:00
Mitchell Hashimoto
0d82b120da termio: set configured default cursor style on startup
Fixes #958
2023-12-01 19:39:16 -08:00
Mitchell Hashimoto
516edf1506 termio: only change mouse shape if it is changing
Fixes #976
2023-12-01 19:35:18 -08:00
Mitchell Hashimoto
5e3f66299c Merge pull request #778 from mitchellh/mrn/gtk-tabs-splits
gtk: add support for splits
2023-12-01 13:46:19 -08:00
Mitchell Hashimoto
bd49947f98 apprt/gtk: fix next split issue 2023-12-01 13:45:56 -08:00
Mitchell Hashimoto
d311fb93ed apprt/gtk: gotoSplit gets proper previous/next direction 2023-12-01 13:21:31 -08:00
Mitchell Hashimoto
f811ac6b18 apprt/gtk: gotoSplit, has some bugs 2023-12-01 09:58:57 -08:00
Mitchell Hashimoto
dc2cee1c78 apprt/gtk: rename parentSurface 2023-12-01 09:15:30 -08:00
Mitchell Hashimoto
967e091e2c apprt/gtk: just heap allocate the title text 2023-12-01 09:14:08 -08:00
Mitchell Hashimoto
c2c8f78cf8 apprt/gtk: comments 2023-12-01 09:11:14 -08:00
Mitchell Hashimoto
14ef6fb2f9 apprt/gtk: add comments, rename some funcs 2023-12-01 09:07:37 -08:00
Mitchell Hashimoto
e40b79906e apprt/gtk: do not deinit tab in closeTab 2023-12-01 09:07:09 -08:00
Mitchell Hashimoto
dd39b29f30 apprt/gtk: we don't need to keep track of Tabs 2023-12-01 08:52:08 -08:00
Mitchell Hashimoto
c7eeda1f00 apprt/gtk: code aesthetic changes 2023-12-01 08:08:06 -08:00
Gregory Anders
b448501bf4 Preserve cursor shape when over a link
If mouse events are active and the cursor is hovered over a link,
pressing Shift does not change the cursor to a pointer, but to the text
selection shape, until the cursor is moved again. The pointer shape
should have higher priority over the text selection shape when the
cursor is hovered over a pointer.
2023-12-01 10:06:27 -06:00
Mitchell Hashimoto
89f4cf11c7 apprt/gtk: rename parent2 to parent 2023-11-30 21:46:43 -08:00
Thorsten Ball
7e9dce054f gtk: remove unneeded method setContainer on Surface
We don't need to update the titles, etc. since that's done by
`grabFocus` and that then makes the method not that useful. Removing for
now.
2023-11-30 21:44:52 -08:00
Thorsten Ball
1b4fc83f43 gtk: switch to long-held reference for GtkPaned 2023-11-30 21:44:52 -08:00