Commit graph

1984 commits

Author SHA1 Message Date
Alexander Sieg
a8da30c437 include sys/timerfd as required by epoll-shim 2020-05-07 20:32:29 +02:00
Alexander Sieg
7d314ce738 Disable O_NONBLOCK assert on FreeBSD 2020-05-03 17:50:21 +02:00
Daniel Eklöf
770bd79a9c meson: try to workaround 'tic' writing multiple files into a subdirectory
tic writes all our terminfo files into a subdirectory. This is
difficult for meson to groc; you can for example not say

  output: ['f/foot', 'f/foot-direct']

This tries to workaround it by setting 'install: false' in the 'tic'
custom target, and instead add two separate targets for each terminfo
file.

Since the compiled terminfo file 'foot' would collide with the
executable 'foot', all terminfo stuff has been moved into a
subdirectory.
2020-05-03 17:48:40 +02:00
Alexander Sieg
b8e9e1ca06 made generate-unicode-precompose.sh work on BSD systems
bsd cut takes the files always as the last argument, according to the
gnu man page this should be the same for gnu cut

A Bourne shell should be available under /bin/sh on most if not all posix
conform systems
2020-05-03 14:42:29 +02:00
Alexander Sieg
0488aa6b5e Replaced HOST_NAME_MAX with portable version 2020-05-03 14:42:29 +02:00
Alexander Sieg
a318fb4efa MAP_UNINITIALIZED doesn't exists on FreeBSD 2020-05-03 14:42:29 +02:00
Alexander Sieg
fc8e51a4dc Disable scrolling code for FreeBSD
This is do to the fact that `fallocate(FALLOC_FL_PUNCH_HOLE)` is not
available under FreeBSD
2020-05-03 14:42:29 +02:00
Alexander Sieg
de7c8467f0 epoll_shim and stdthreads are needed on freebsd 2020-05-03 14:42:29 +02:00
Alexander Sieg
12c370ee19 Pass new proc_title as a arg and use format string 2020-05-03 14:42:29 +02:00
Alexander Sieg
d3c4810885 Forgot a header in render.c 2020-05-03 14:42:29 +02:00
Alexander Sieg
6d17515646 Fixed headers for FreeBSD 2020-05-03 14:42:29 +02:00
Daniel Eklöf
6bac1bd257
term: thrd_success isn't necessarily 0 2020-05-03 14:17:54 +02:00
Daniel Eklöf
729a57d3a8
util: thrd_err_as_string: fix alignment 2020-05-03 12:40:40 +02:00
Daniel Eklöf
7525fa20c2
thrd_create(): handle errors correctly
* Detect thrd_create() failures in all places where we instantiate
  threads
* Log error correctl; thrd_create() does not return an errno value
2020-05-03 12:25:04 +02:00
Daniel Eklöf
dd3f43d65c
util: thrd_err_as_string(): new function, returns a thrd_*() error string 2020-05-03 12:24:34 +02:00
Daniel Eklöf
1d1eb89925
Merge branch 'space-optimize-combining-chars' 2020-05-03 11:36:20 +02:00
Daniel Eklöf
4d4df92f66
unicode-combining: limit maximum number of allowed composed chains 2020-05-03 11:31:59 +02:00
Daniel Eklöf
1ebdc01162
unicode-combining: detect when we've reached the chain limit
We currently store up to 5 combining characters in any given
base+combining chain.

This adds a check for when that limit is about to be exceeded. When
this happens, we log the chain + the new combining character.

Since things will break anyway, we simply overwrite the last combining
character.
2020-05-03 11:27:06 +02:00
Daniel Eklöf
b7ad4c2e2a
changelog: update 'unicode comining' entry - only parts of the feature are optional 2020-05-03 11:22:38 +02:00
Daniel Eklöf
9638d0213b
readme: update 'Unicode combining' 2020-05-03 11:21:31 +02:00
Daniel Eklöf
62e0774319
unicode-combining: store seen combining chains "globally" in the term struct
Instead of storing combining data per cell, realize that most
combinations are re-occurring and that there's lots of available space
left in the unicode range, and store seen base+combining combinations
chains in a per-terminal array.

When we encounter a combining character, we first try to pre-compose,
like before. If that fails, we then search for the current
base+combining combo in the list of previously seen combinations. If
not found there either, we allocate a new combo and add it to the
list. Regardless, the result is an index into this array. We store
this index, offsetted by COMB_CHARS_LO=0x40000000ul in the cell.

When rendering, we need to check if the cell character is a plain
character, or if it's a composed character (identified by checking if
the cell character is >= COMB_CHARS_LO).

Then we render the grapheme pretty much like before.
2020-05-03 11:03:22 +02:00
Daniel Eklöf
ae7383189a
osc: fix scaling of RGB formatted color specifiers 2020-05-02 23:07:26 +02:00
Daniel Eklöf
9eda632c97
osc: OSC 12: mimic xterm - a color value of 0 means use inverted fg/bg 2020-05-02 23:00:21 +02:00
Daniel Eklöf
db9b99e8ac
osc: fix 'OSC 12 ?' to return the cursor color, not the cursor text color 2020-05-02 22:58:30 +02:00
Daniel Eklöf
ac58d05c6b
osc: fix scaling of legacy formatted color specifiers 2020-05-02 22:57:12 +02:00
Daniel Eklöf
ef637fb5e8
render: don't re-instantiate the foreground pixman source 2020-05-02 22:14:48 +02:00
Daniel Eklöf
b10436e49b
vt: use signed integers to correctly detect when we're done 2020-05-02 20:01:43 +02:00
Daniel Eklöf
39024681ec
readme: sligh re-wording of the "Unicode combining" chapter 2020-05-02 19:57:18 +02:00
Daniel Eklöf
804642580e
meson: don't generate pre-compose table when -Dunicode-precompose=false 2020-05-02 18:43:13 +02:00
Daniel Eklöf
d8ebed0ee0
meson: only define FOOT_UNICODE_PRECOMPOSE if combining chars > 0 2020-05-02 18:42:47 +02:00
Daniel Eklöf
265a88c1ce
meson: generate unicode compose table
This replaces the pre-generated table used up until now.
2020-05-02 18:29:39 +02:00
Daniel Eklöf
a24a3520c7
script: generate-unicode-precompose: generate a complete header file 2020-05-02 18:25:15 +02:00
Daniel Eklöf
5a5b8140c4
readme: utf8proc is no longer a dependency 2020-05-02 17:36:22 +02:00
Daniel Eklöf
83e6b6df5d
changelog: try to fix link for Codebergs markdown parser 2020-05-02 17:35:04 +02:00
Daniel Eklöf
2df7b3c611
changelog: remove bad ']' in link 2020-05-02 17:34:19 +02:00
Daniel Eklöf
d945b68b73
unicode-combine: remove utf8proc dependency
We only used utf8proc to try to pre-compose a glyph from a base and
combining character.

We can do this ourselves by using a pre-compiled table of valid
pre-compositions. This table isn't _that_ big, and binary searching it
is fast.

That is, for a very small amount of code, and not too much extra RO
data, we can get rid of the utf8proc dependency.
2020-05-02 17:29:00 +02:00
Daniel Eklöf
8389c76549
unicode-combining: don't limit ourselves to the (western) diacritics blocks 2020-05-02 16:11:51 +02:00
Daniel Eklöf
3b29aa95c9
render: de-indent #if statement 2020-05-01 21:51:40 +02:00
Daniel Eklöf
4ae0e7c922
unicode-combining: pack struct 2020-05-01 21:47:38 +02:00
Daniel Eklöf
0c7a94dfdc
unicode-combine: leave a note saying we might need more than 2 combining chars 2020-05-01 20:19:46 +02:00
Daniel Eklöf
50543983ad
unicode-combine: only compose if we don't have any other combining characters
If the client sent the sequence SAB, where SA does NOT have a composed
representation, but SB does, the old code would compose SB and throw
away A.

This patch fixes this by only allowing a compose if there aren't
any pre-existing combining characters.
2020-05-01 20:17:37 +02:00
Daniel Eklöf
a6cd151cc7
meson: emit a 'summary()' at the end 2020-05-01 12:32:10 +02:00
Daniel Eklöf
99172e7f8e
Merge branch 'unicode-combining-for-real' 2020-05-01 12:06:09 +02:00
Daniel Eklöf
3474624c2c
unicode-combining: completely remove unicode combining characters when feature is disabled 2020-05-01 12:05:38 +02:00
Daniel Eklöf
66e5abdda3
term: combining characters: reduce max number of combining characters 2020-05-01 12:00:36 +02:00
Daniel Eklöf
9f3d07ff21
changelog: rewrite entry for combining characters 2020-05-01 12:00:01 +02:00
Daniel Eklöf
623329cf23
selection: extract text: also copy combining characters 2020-05-01 11:59:09 +02:00
Daniel Eklöf
76567e9ef0
render: render combining characters
This is basically just a loop that renders additional glyphs on top
off the base glyph.

Since we now need access to the row struct, for the combining
characters, the function prototype for 'render_cell()' has changed.

When rendering the combining characters we also need to deal with
broken fonts; some fonts use positive offsets (as if the combining
character was a regular character), while others use a negative
offset (to be used as if you had already advanced the pen position).

We handle both - a positive offset is rendered just like a regular
glyph. When we see a negative offset we simply add the width of a cell
first.
2020-05-01 11:56:13 +02:00
Daniel Eklöf
40bf01a8e6
grid: reflow: copy combining characters 2020-05-01 11:55:22 +02:00
Daniel Eklöf
cb5f80ec6a
vt: utf8: track combining characters that we failed to compose
When we detect a combining character, we first try to compose it with
the base character (like before).

When this fails, we instead add the combining character to the base
cell's combining characters array.

The reason for using a composed character when possible is twofold:
one, the rendered glyph will look better since it will be a single
glyph instead of two separate glyphs (possibly from different
fonts(!)). And two, for performance. A composed glyph is a single
glyph to render, while a decomposed glyph sequence means the renderer
has to render multiple glyphs for a single cell.
2020-05-01 11:52:40 +02:00