598 Commits

Author SHA1 Message Date
Mitchell Hashimoto
a9b34b43c5 code for getting physical DPI
we don't need it but I want to put it in Git history
2022-08-25 15:53:29 -07:00
Mitchell Hashimoto
9601920b4d font size is now in font points, determine size based on window DPI 2022-08-25 12:29:28 -07:00
Mitchell Hashimoto
46bbab5d10 ignore zero-width characters for now 2022-08-24 13:48:22 -07:00
Mitchell Hashimoto
d0f888daae update TODO, we fixed atlas resizing 2022-08-24 12:41:51 -07:00
Mitchell Hashimoto
f4b1783c1f atlas tracks modified/resize state, reallocate on GPU if resized 2022-08-24 12:41:31 -07:00
Mitchell Hashimoto
d8248ef0ae fix data corruption on growing the Atlas 2022-08-24 12:14:02 -07:00
Mitchell Hashimoto
4751e3185d update TODO 2022-08-24 11:32:47 -07:00
Mitchell Hashimoto
76bce8893c Keybindings, support arrow keys, home/end, page up/down
Introduces a more robust keybinding system. Previously, keybinds were hardcoded into literal `if key = this and modifier = that`. Now, we have a system for defining keybindings in a human friendly way i.e. `super+c=copy_from_clipboard` and a system internally for looking up and executing keybind actions.

There's still a lot more keybinds we can add support for but now that this system is in place it should be easy to do as we get there. Namely, we need to fully implement this: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-PC-Style-Function-Keys

You can now set custom keybinds by specifying the `--keybind` flag to the program. Example: `ghostty --keybind=super+c=copy_from_clipboard`. You can repeat this flag to specify more keybinds. The full set of actions available is in `src/input/Binding.zig` under `Action`.
2022-08-24 11:24:30 -07:00
Mitchell Hashimoto
5713c2f468 move input test to qualified 2022-08-24 11:17:28 -07:00
Mitchell Hashimoto
3b5a9caff5 hook up more control keys: home, end, page up, page down 2022-08-24 11:16:36 -07:00
Mitchell Hashimoto
80376ce6da hook up keybindings for copy/paste and arrow keys 2022-08-24 11:08:39 -07:00
Mitchell Hashimoto
e6f09093dd unify non-printables up by bindings 2022-08-24 10:21:27 -07:00
Mitchell Hashimoto
b33268cee3 only handle non-printables on press/release, and BS is 0x7F 2022-08-24 10:18:05 -07:00
Mitchell Hashimoto
622537d665 look up keybindings on keypress, clean up how non-printables are handled 2022-08-24 10:02:13 -07:00
Mitchell Hashimoto
2800a46854 keybind parsing in CLI args 2022-08-24 09:31:14 -07:00
Mitchell Hashimoto
222f70857a move input stuff to src/input 2022-08-23 19:52:14 -07:00
Mitchell Hashimoto
bc9f81e8d2 binding parse action with parameter 2022-08-23 17:48:52 -07:00
Mitchell Hashimoto
7303909d01 key.Binding and basic parsing 2022-08-23 17:40:36 -07:00
Mitchell Hashimoto
5d8915cc9a remove unused zig file 2022-08-23 15:30:13 -07:00
Mitchell Hashimoto
8e1e8cfc51 pin new zig-overlay repo 2022-08-23 10:23:02 -07:00
Mitchell Hashimoto
3774972caf update mach 2022-08-23 10:07:18 -07:00
Mitchell Hashimoto
5c61bfbe8f fix stage2 compiler error 2022-08-21 21:38:24 -07:00
Mitchell Hashimoto
13225a2d78 remove done shader TODO 2022-08-20 17:39:34 -07:00
Mitchell Hashimoto
f19f5fdc79 update TODO 2022-08-20 17:37:41 -07:00
Mitchell Hashimoto
235146ccd4 Emoji and Wide Unicode Char Support (i.e. Asian characters)
Many changes to support emoji and wide chars:

- Freetype built with libpng support (some emoji font use pngs)
- Introduced `font.FallbackSet` structure for looking for glyphs in multiple fonts so we can find emojis
- Texture atlas supports 3 and 4 channel colors (RGB/RGBA, although emojis are in BGRA)
- `font.Face` supports loading colored fonts and glyphs
- `font.Face` supports fonts that do not support variable pixel sizes
- Shader supports two textures (greyscale and colored)
- Shader will downsample glyphs that don't fit into the cell size because some fixed size emoji fonts are large
- Shader supports wide (2x) cells across all types: cursor, fg, bg, underline
- Terminal state supports detecting and managing wide (2x) chars by looking them up in the Unicode EastAsianWidth database and populating "spacer" cells.
- Selection (and clipboard ops) support wide chars
2022-08-20 17:33:59 -07:00
Mitchell Hashimoto
ec288d9111 get rid of assertions because its possible they're false 2022-08-20 17:21:14 -07:00
Mitchell Hashimoto
561bbca053 don't render wide char trailers 2022-08-20 17:17:13 -07:00
Mitchell Hashimoto
28072157d5 selection of wide chars and copy/paste works 2022-08-20 17:10:10 -07:00
Mitchell Hashimoto
8a1d7070b3 render wide chars 2022-08-20 16:49:55 -07:00
Mitchell Hashimoto
da79aae0ab terminal: print wide characters 2022-08-20 16:11:48 -07:00
Mitchell Hashimoto
ecf8353c74 support dynamic linking (not default) test in GH actions 2022-08-20 15:21:24 -07:00
Mitchell Hashimoto
f93e9eedb3 font: move codepoint into a public API 2022-08-20 10:50:37 -07:00
Mitchell Hashimoto
32d96dd49b add utf8proc so we can detect unicode char width 2022-08-20 10:48:54 -07:00
Mitchell Hashimoto
e83262e48e nix: remove libpng 2022-08-20 10:37:39 -07:00
Mitchell Hashimoto
813f11a5eb fix crash that could happen looking up fallback 2022-08-20 10:37:12 -07:00
Mitchell Hashimoto
c29f4cace6 remove the font style fallback for the fallback set 2022-08-20 10:37:12 -07:00
Mitchell Hashimoto
6026fdf834 only downsample size if its an emoji 2022-08-20 10:37:12 -07:00
Mitchell Hashimoto
43c61f57ef font FallbackSet for looking up in fallback TTFs (emoji) 2022-08-20 10:37:12 -07:00
Mitchell Hashimoto
22ed65a818 really hacked in emoji support, time to clean it up 2022-08-20 10:37:11 -07:00
Mitchell Hashimoto
3d6ca0e423 font face supports loading color fonts (emoji!) 2022-08-20 10:37:11 -07:00
Mitchell Hashimoto
5d27fd55e9 temp: add libpng to nix 2022-08-20 10:37:06 -07:00
Mitchell Hashimoto
5ae450099d freetype builds in png support, uses our own zlib 2022-08-20 10:33:57 -07:00
Mitchell Hashimoto
54b0c6cd03 Merge branch 'ft-libpng' 2022-08-20 10:25:32 -07:00
Mitchell Hashimoto
43e42a54cd vendor 2022-08-20 10:25:19 -07:00
Mitchell Hashimoto
728df4af16 build libpng and link freetype to it 2022-08-20 10:24:49 -07:00
Mitchell Hashimoto
583eec0fe6 zlib 2022-08-20 10:02:04 -07:00
Mitchell Hashimoto
f9313801f1 avoid an alloc and buffer copy in the common case on font loading 2022-08-19 15:12:57 -07:00
Mitchell Hashimoto
742dd010eb Texture atlas supports variable color depth, not just greyscale 2022-08-19 14:37:22 -07:00
Mitchell Hashimoto
eeaad799e5 get rid of Z buffer stuff
This optimization will take more work, and we already got a lot of the
way there by optimizing how we send data down to the GPU.
2022-08-19 13:48:34 -07:00
Mitchell Hashimoto
2351f88631 updateCell sets the proper Z value and bumps it 2022-08-19 13:34:07 -07:00