Commit graph

1983 commits

Author SHA1 Message Date
Daniel Eklöf
c7b031e177
generate-unicode-precompose: /bin/sh is more standard than /usr/bin/sh
At the same time, fix `cut` command to pass filename last, as this is
also more portable.

Fixes build issues on e.g. Alpine Linux
2020-05-09 12:42:40 +02:00
Daniel Eklöf
c090a0664f
Revert "term: print: line-wrap multi-column characters instead of cutting them in half"
This reverts commit 8448296bb3.

Applications need to be multi-column character aware anyway, and they
should deal with this.
2020-05-09 12:04:55 +02:00
Daniel Eklöf
8448296bb3
term: print: line-wrap multi-column characters instead of cutting them in half 2020-05-09 11:57:19 +02:00
Daniel Eklöf
2e7ead42de
completions: zsh: complete command/shell, and its arguments 2020-05-08 18:45:05 +02:00
Daniel Eklöf
5b70f94827
main/client: be POSIXLY_CORRECT when parsing command line
This means command line parsing stops when it encounters the first
nonoption argument.

The result is that one no longer need to use '--' to ensure arguments
are passed to the shell/command, instead of parsed by foot.

That is, instead of

  foot -- sh -c true

one can now do

  foot sh -c true

Arguments to foot *must* go before the command:

  foot --fullscreen sh -c true
2020-05-08 18:43:03 +02:00
Daniel Eklöf
56d53ec2a1
term: don't register ptmx with FDM if we're shutting down
This can happen when there's an error instantiating the
terminal *after* we've spawned the slave process.
2020-05-04 20:49:28 +02:00
Daniel Eklöf
9864d91975
term: set 'is_shutting_down' before calling term_destroy() on error 2020-05-04 20:46:27 +02:00
Daniel Eklöf
af9e5aef2b
csi: ignore invalid parameters in 'CSI Ps <space> q'
Before this patch, an invalid parameter would not change the cursor
style, but could cause the cursor to start (or stop) blinking.
2020-05-04 20:19:24 +02:00
Daniel Eklöf
921331854a
term: check return value when instantiating thread synchronization primitives 2020-05-04 20:11:45 +02:00
Daniel Eklöf
728db1df0e
meson: use find_program() to find 'tic' 2020-05-03 16:39:10 +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
Daniel Eklöf
67614df9f9
term: print: reset combining characters for this cell
This is the *only* place combining characters are reset. In
particular, we do *not* reset them in a normal cell erase.

This is a performance design decision - clearing the combining
characters in erase is way too slow.

This way, we clear it only when we *have* to. Anything looking at the
combining characters must first ensure the base character is not 0.
2020-05-01 11:50:38 +02:00