4505 Commits

Author SHA1 Message Date
Mitchell Hashimoto
8dba9f0cd6 Merge pull request #1081 from vancluever/vancluever-rect-select-fix-drag
Surface: fix some rectangle select behaviors
2023-12-13 12:12:08 -08:00
Mitchell Hashimoto
cfc4889572 Merge pull request #1077 from meatcar/gtk-tab-middleclick-close
gtk: close tabs with middle-click
2023-12-13 11:59:41 -08:00
Mitchell Hashimoto
63f2d3ff1a Merge pull request #1079 from mitchellh/unadjusted-box
font/sprite: manually determine which box codepoints are unadjusted
2023-12-13 11:07:15 -08:00
Mitchell Hashimoto
c0eded766a input/kitty: do not encode event+mods if they're both default 2023-12-13 10:57:17 -08:00
Chris Marchesi
aeaf5ea467 Surface: fix some rectangle select behaviors
This fixes a couple of subtle rectangle select behaviors:

* Corrects how selection rolls over when crossing the x-boundary; this
  was mentioned in #1021, this properly corrects it so both sides of the
  x-boundary do not share characters.

* Corrects a minor quirk in the selection of initial cells in a
  selection - this can be more readily observed when selecting a single
  line with rectangle select. To correct this, we only use the x axis
  when calculating this instead of both x and y.
2023-12-13 10:51:17 -08:00
Mitchell Hashimoto
08e0d0b836 apprt/gtk: do not encode control characters into utf8 event field 2023-12-13 10:45:47 -08:00
Mitchell Hashimoto
85b40874cf font/sprite: manually determine which box codepoints are unadjusted
Some box codepoints (the cursor) want to use the original font metrics
height but others (corners) want to use the full grid height. I can't
see a better way to do this than manually maintaining a switch here. We
can add codepoints as needed.
2023-12-13 10:32:16 -08:00
Denys Pavlov
fc7013fc2e gtk: close tabs with middle-click
Follow the behaviour of other tabbed interfaces like browsers, editors,
and file-managers.

GTK code is based on `/src/apprt/gtk/ImguiWidget.zig`
2023-12-13 11:14:35 -05:00
Tim Culverhouse
4bd9b1365a key: add TODO's for media keys
Add TODO comments in places where we need to add media keys.
2023-12-13 06:57:15 -06:00
Tim Culverhouse
a0880bcfed key: add additional keypad keys
Add additional keypad keys to the encoding scheme. This allows Ghostty
to report KP_HOME and it's relatives. We also always check for a keyval
first, so we can report KP_7, etc as opposed to ASCII '7'.
2023-12-13 06:55:22 -06:00
Tim Culverhouse
eb8fc910e0 gtk: get num_lock state for key events
GTK doesn't expose the num_lock state via the key press event, this must
be obtained directly from the device. Set the num_lock state in the
modifier mask. This also will never show up as a `consumed_mod`, so we
don't bother setting it there.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2023-12-13 06:55:22 -06:00
Mitchell Hashimoto
20dbe9792e Merge pull request #1072 from mitchellh/cell-height
`adjust-cell-height` adjustments
2023-12-12 20:59:48 -08:00
Mitchell Hashimoto
1c3948f4d7 Merge pull request #1062 from mitchellh/mrn/gtk-equalize-splits
gtk: implement equalize_splits
2023-12-12 20:59:33 -08:00
Mitchell Hashimoto
8fc0cdb220 font: cursor size remains original cell height if height adjusted
Fixes #1067
2023-12-12 20:43:11 -08:00
Thorsten Ball
47b0592c73 gtk: use f64 everywhere instead of i16/f16/c_int 2023-12-13 05:38:34 +01:00
Mitchell Hashimoto
dafc02e29c font: adjust cell baseline to center after modification, fix styles
Fixes #1064
Fixes #1066
2023-12-12 20:14:02 -08:00
Mitchell Hashimoto
6403ef1198 font/coretext: ceil the cell height and ascent metrics
Fixes #1068
2023-12-12 19:58:57 -08:00
Matt Robenolt
3866e09210 Use packed struct 2023-12-12 17:20:42 -08:00
Matt Robenolt
91937c4ada Apply feedback 2023-12-12 17:14:47 -08:00
Matt Robenolt
8e607f372b Configurable unfocused dimming color 2023-12-12 16:34:41 -08:00
Thorsten Ball
e67fa7abe0 gtk: implement equalize_splits
This adds support for the equalize_splits feature that's already
implemented for macOS.

It's essentially a port of the Swift implementation, using the same
weights-mechanism to equalize split sizes.
2023-12-12 19:30:29 +01:00
Mitchell Hashimoto
2f9750ad7f Merge pull request #1057 from vancluever/vancluever-powerline-half-circle-ellipse-refs
Powerline: add references for the ellipse algorithm
2023-12-12 07:46:59 -08:00
Gregory Anders
2da05a6d5c term: parse hex color string for OSC commands 2023-12-12 09:43:38 -06:00
Chris Marchesi
c03ae47a27 Powerline: add references for the ellipse algorithm
Further to the additional comments in #1055, this adds some references
to the comments in the ellipse algorithm (including the original
reference for the circle algorithm).
2023-12-12 00:10:40 -08:00
Mitchell Hashimoto
e5acb082c1 Merge pull request #1056 from mitchellh/ct-shaping
CoreText font shaper, fix glyph offset handling (in Harfbuzz, too)
2023-12-11 22:17:27 -08:00
Mitchell Hashimoto
24d4981996 font: note why shaper is not enabled 2023-12-11 21:58:49 -08:00
Mitchell Hashimoto
bcf6753c68 renderer/opengl: use new glyph offsets 2023-12-11 21:47:03 -08:00
Mitchell Hashimoto
34cdb871f5 font/coretext: clarify buggy coretext shaper 2023-12-11 21:42:49 -08:00
Mitchell Hashimoto
489ed57e2f font/harfbuzz: track x/y offsets 2023-12-11 21:41:13 -08:00
Mitchell Hashimoto
114723af9e font/coretext: shaper applies x/y offsets 2023-12-11 21:22:30 -08:00
Chris Marchesi
4aa56ab8dd Powerline: Change half-circle algorithm to ellipse
This changes the half-circle drawing algorithm for glyphs E0B4 and E0B6
to an ellipse algorithm.

This fixes a shortcoming in the circle approach - how do you handle
drawing for a box that is not a typical 2:1 H*W? We were trying to
anticipate this by taking the smaller of the two axes and using that for
the radius. This works when there's some error in the zoom and the x
radius somehow becomes larger than the y radius (in observation, this
happens occasionally in some zoom steps, but only slightly).

However, turns out a more realistic anticipation is for fonts that have
a much *larger* height-to-width ratio. Iosevka, for example, has an
approx. 2.6:1 ratio (observed in the inspector). In this instance, this
approach does nothing except lock the circle to an extremely small
radius. For this instance, we need an ellipse, which will handle all
cases in an expected fashion.

Fixes #1050.
2023-12-11 21:01:11 -08:00
Mitchell Hashimoto
fcd9de0311 font/coretext: coretext shaper is cleaner 2023-12-11 12:56:30 -08:00
RGBCube
d659b12fb9 input: add scroll_page_lines 2023-12-11 23:35:40 +03:00
Mitchell Hashimoto
62a5fe0236 font/shape: add coretext shaper 2023-12-11 11:13:49 -08:00
Mitchell Hashimoto
22a0869525 font/shaper: if char is 0, should send space to shaper 2023-12-11 11:12:29 -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
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
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