115 Commits

Author SHA1 Message Date
Mitchell Hashimoto
5c1fbd09cd font: shaper dynamically allocates cell buffer
Pathlogical grapheme clusters can use a LOT of memory, so we need to be
able to grow.
2023-09-26 17:59:16 -07:00
Mitchell Hashimoto
b1389cbbfe renderer: support font style changing at runtime 2023-09-26 08:51:04 -07:00
Mitchell Hashimoto
4b791f3ee1 renderer: always reset font group on config change 2023-09-26 08:18:11 -07:00
Mitchell Hashimoto
4b8056afd8 renderer/opengl: remove gpucell lru cache
There was no noticable performance improvement and it complicated the
code and also diverged it from Metal.
2023-09-22 09:47:01 -07:00
Mitchell Hashimoto
bebf6bb108 renderer/opengl: only skip drawing cells if they're empty, not clear
Fixes #518

This optimization to avoid a draw call to OpenGL was premature. This
optimization is fine but needs to happen only for the draw calls. We
still need to clear the screen if we have no cells.

This was causing #518 because when the cursor was blinked (invisible)
then we had no cells so we'd skip the draw call which reused the old
buffer state for OpenGL.
2023-09-22 09:45:26 -07:00
Mitchell Hashimoto
0cf2ed6a9f renderer/opengl: gl state init needs to set blending, realization 2023-09-16 11:26:07 -07:00
Mitchell Hashimoto
a19acf14d2 renderer/opengl: support reloading the Opengl state 2023-09-16 09:37:29 -07:00
Mitchell Hashimoto
58100f0a00 renderer/opengl: OpenGL state may be nil to disable rendering 2023-09-16 09:08:35 -07:00
Mitchell Hashimoto
10989ae7b0 renderer: implement underline cursor 2023-09-10 22:05:47 -07:00
Mitchell Hashimoto
3583a0c1ca renderer/opengl: new cursor apis 2023-09-09 20:37:56 -07:00
Mitchell Hashimoto
a6c40d0417 renderer: always show cursor if window is not focused
Fixes #400

This ensures the hollow box is shown even if the cursor is not in a
blinking state when unfocus happens. We still hide the cursor even on
unfocus if the terminal mode explictly asks for a hidden cursor.
2023-09-06 11:23:42 -07:00
SoraTenshi
6faed268e0 config: clean up cursor style configuration 2023-09-03 07:51:36 -07:00
Mitchell Hashimoto
22eb533473 content scale change events should also impact viewport padding
This calculates the new padding pixel values and propogates those
changes to the renderer.
2023-09-02 11:00:51 -07:00
Mitchell Hashimoto
e2fae7ab2b surface should default to default cursor, blinking should check selected 2023-08-30 08:12:38 -07:00
Mitchell Hashimoto
ae0de7bce4 renderer: split ligature around cursor even if cursor is flashing
Fixes #356
2023-08-29 13:49:14 -07:00
Mitchell Hashimoto
0204d94921 Merge pull request #349 from mitchellh/sync
Synchronized Output Sequence
2023-08-28 13:15:50 -07:00
Mitchell Hashimoto
5168dc7645 renderer: do not render if synchronized output is on 2023-08-28 11:38:11 -07:00
SoraTenshi
fcf1537f82 config: Add option for custom cursor style 2023-08-28 18:20:45 +02:00
Kevin Hovsäter
8b9a11db4b Implement cursor text in addition to color 2023-08-26 15:29:48 +02:00
Mitchell Hashimoto
7ccf86b175 remove imgui and devmode
imgui has been a source of compilation challenges (our fault not theirs)
and devmode hasn't worked in awhile, so drop it.
2023-08-20 08:50:24 -07:00
Mitchell Hashimoto
ab68569281 renderer/opengl: fix compilation for new modes style 2023-08-15 13:33:06 -07:00
Mitchell Hashimoto
55778a049b apprt/gtk, opengl: render preedit 2023-08-11 12:37:27 -07:00
cryptocode
6045088afc Don't show hollow cursor in inactive windows when cursor is hidden.
This is the behavior of the other terminals I have, such as iTerm, allcritty, WezTerm, and Kitty. The hollow cursor is especially noticable when running in two panes,
one of them inactive with animations (such as a progress bar)
2023-08-11 17:20:03 +02:00
Mitchell Hashimoto
85e32f9a15 renderer: hide cursor is state explicit asks for invisible cursor
This was a regression. The previous logic would always show the cursor
if we were using a non-blinking cursor. But, if the terminal state is
explicitly requesting an invisible cursor (mode 25) then we need to hide
the cursor.
2023-08-06 09:55:13 -07:00
Mitchell Hashimoto
2065dd77d7 renderer/opengl: need to release OpenGL context with glfw 2023-08-05 22:33:55 -07:00
Mitchell Hashimoto
4b062dc45c font/shaper: text runs should split around block cursors
Fixes #206
2023-07-18 16:20:30 -07:00
Mitchell Hashimoto
3d48432daf renderer: change padding to integers
Screen size is always an integer, it makes sense for padding to also be
rounded to some integer.
2023-07-18 10:44:33 -07:00
Mitchell Hashimoto
ea268bae5e renderer: do not blink explicit steady cursor styles 2023-07-10 11:27:37 -07:00
Mitchell Hashimoto
13315471d7 renderer: double line widths for sprite fonts when font-thicken is true
Fixes #193
2023-07-07 09:08:46 -07:00
Mitchell Hashimoto
45ac9b5d4c font-feature config to enable/disable OpenType Font Features 2023-07-05 13:12:30 -07:00
Mitchell Hashimoto
55313fcbd5 opengl: support background opacity 2023-07-03 19:51:11 -07:00
Mitchell Hashimoto
0faf6097d0 Change font metrics to all be integers, not floats.
Font metrics realistically should be integral. Cell widths, cell
heights, etc. do not make sense to be floats, since our grid is
integral. There is no such thing as a "half cell" (or any point).

The reason we historically had these all as f32 is simplicity mixed
with history. OpenGL APIs and shaders all use f32 for their values, we
originally only supported OpenGL, and all the font rendering used to be
directly in the renderer code (like... a year+ ago).

When we refactored the font metrics calculation to its own system and
also added additional renderers like Metal (which use f64, not f32), we
never updated anything. We just kept metrics as f32 and casted
everywhere.

With CoreText and #177 this finally reared its ugly head. By forgetting
a simple rounding on cell metric calculation, our integral renderers
(sprite fonts) were off by 1 pixel compared to the GPU renderers.
Insidious.

Let's represent font metrics with the types that actually make sense: a
cell width/height, etc. is _integral_. When we get to the GPU, we now
cast to floats. We also cast to floats whenever we're doing more precise
math (i.e. mouse offset calculation). In this case, we're only
converting to floats from a integral type which is going to be much
safer and less prone to uncertain rounding than converting to an int
from a float type.

Fixes #177
2023-07-03 11:23:20 -07:00
Mitchell Hashimoto
0bb2d22052 renderer: hook up font thickening setting 2023-07-01 10:01:40 -07:00
Mitchell Hashimoto
3795cd6c2d font: turn rasterization options into a struct, add thicken 2023-07-01 09:55:19 -07:00
Mitchell Hashimoto
314f9287b1 Update Zig (#164)
* update zig

* pkg/fontconfig: clean up @as

* pkg/freetype,harfbuzz: clean up @as

* pkg/imgui: clean up @as

* pkg/macos: clean up @as

* pkg/pixman,utf8proc: clean up @as

* clean up @as

* lots more @as cleanup

* undo flatpak changes

* clean up @as
2023-06-30 12:15:31 -07:00
Mitchell Hashimoto
56f8e39e5b Update zig, mach, fmt 2023-06-25 11:08:20 -07:00
Mitchell Hashimoto
c6356930cc renderer: support invisible attribute 2023-06-25 09:31:33 -07:00
Mitchell Hashimoto
1c2451b532 renderer: render underline color if set 2023-06-20 09:39:52 -07:00
Mitchell Hashimoto
1d14b121c0 renderer: do not draw cursor cell inversion if we don't draw the cursor
We previously used the "screen.viewportIsBottom" check but this is
always true since awhile back since we copy only the viewport now. A
cleaner check really is that we only track the cursor cell if we're even
drawing the cursor.
2023-05-25 21:41:43 -07:00
Mitchell Hashimoto
2be4eb0da7 font/shaper: split runs at selection boundaries 2023-03-23 10:24:22 -07:00
Mitchell Hashimoto
dfb40426a0 move selection to screen 2023-03-21 10:43:50 -07:00
Mitchell Hashimoto
b0b3b0af2d update config messages use pointers now to make messages small again 2023-03-19 10:48:42 -07:00
Mitchell Hashimoto
7eda21d544 surface propagates new config to renderer 2023-03-19 09:50:55 -07:00
Mitchell Hashimoto
f34da17a11 renderer: use a DerivedConfig to avoid the main Config pointer 2023-03-19 09:50:54 -07:00
Mitchell Hashimoto
cf519bcd75 Use procedurally generated sprites for cursors rather than shaders 2023-03-04 15:14:10 -08:00
Mitchell Hashimoto
4e31f14f7b renderer: reset font shaper buffer size on font size change 2023-03-03 14:35:26 -08:00
Mitchell Hashimoto
aa49cceb49 opengl: make setting font size thread safe 2023-02-24 07:58:31 -08:00
Mitchell Hashimoto
6acf67ec66 gtk: render! 2023-02-24 07:58:30 -08:00
Mitchell Hashimoto
b19f9b2aff opengl: enable single-threaded draw 2023-02-24 07:58:30 -08:00
Mitchell Hashimoto
7eb7cae9e0 opengl: move screen size GL context changes into draw path 2023-02-24 07:58:30 -08:00