Commit graph

2005 commits

Author SHA1 Message Date
Daniel Eklöf
1a8ccb0ffa
selection/render: sync cells' 'selected' bit before rendering
For performance reasons, we track whether a cell is selected or not
using a bit in a cell's attributes.

This makes it easy for the renderer to determine if the cells should
be rendered as selected or not - it just have to look at the
'selected' bit instead of doing a complex range check against the
current selection.

This works nicely in most cases. But, if the cell is updated, the
'selected' bit is cleared. This results in the renderer rendering the
cell normally, i.e. _not_ selected.

Checking for this, and re-setting the 'selected' bit when the cell is
updated (printed to) is way too expensive as it is in the hot path.

Instead, sync the 'selected' bits just before rendering. This isn't so
bad as it may sound; if there is no selection this is a no-op. Even if
there is a selection, only those cells whose 'selected' bit have been
cleared are dirtied (and thus re-rendered) - these cells would have
been re-rendered anyway.
2020-05-16 21:36:08 +02:00
Daniel Eklöf
a1c95562fb
term: scrolling: clear selection *before* scrolling
We normally don't clear the selection when scrolling. The exception is
when the selection covers re-used rows. I.e. rows that we scroll in
and clear.

In this case we cancel the selection (we _could_ modify it and keep as
much as possible and only remove the re-used rows...). We must do
this *before* scrolling, since scrolling will swap rows (when there's
a scrolling region). When this happens, the selection is "corrupted",
and canceling it afterwards will not work.
2020-05-16 21:27:56 +02:00
Daniel Eklöf
e3992b8379
selection: update: don't assert on 'start' being set 2020-05-16 21:16:35 +02:00
Daniel Eklöf
e4a2d41f51
selection: don't automatically no-op operations if selection isn't enabled
When the client is capturing the mouse, selection can only be done by
holding done shift.

This is why a lot of selection functions are no-ops if selection isn't
currently enabled.

However, there are many cases where we actually need to modify the
selection. In particular, selection_cancel().

Thus, only check for enabled selection when we're dealing with user
input.

Bonus: this also fixes a bug where an ongoing selection were finalized
as soon as the user released shift, even if he was still holding down
the mouse button.
2020-05-16 21:16:11 +02:00
Daniel Eklöf
38c050746d
selection: on_row_in_view() -> on_rows_in_view(), and now takes a range
This allows us to check the selection once when scrolling, instead of
once for each scrolled in line.
2020-05-16 21:16:11 +02:00
Daniel Eklöf
b647aa447b
render: only apply transparency to the default background color 2020-05-16 16:26:52 +02:00
Daniel Eklöf
0c9b679958
readme: add 'synchronized updates' to feature list
The support in foot isn't new, but let's make it more visible.
2020-05-16 14:16:38 +02:00
Daniel Eklöf
6deae0b07a
terminfo: add tmux extension 'Sync' - indicates 'Synchronized Updates' support 2020-05-16 14:13:45 +02:00
Daniel Eklöf
0955cee902
changelog: prepare for the next, unreleased version 2020-05-13 13:22:19 +02:00
Daniel Eklöf
8bea5855b1
Merge branch 'releases/1.3' 2020-05-13 13:21:34 +02:00
Daniel Eklöf
3ed177bb39
meson/PKGBUILD: bump version to 1.3.0 2020-05-13 13:10:08 +02:00
Daniel Eklöf
9b7b4878f1
changelog 1.3.0 2020-05-13 13:09:12 +02:00
Daniel Eklöf
e654cf3880
slave: configure pts to be the controlling terminal of the forked process 2020-05-13 13:07:44 +02:00
Daniel Eklöf
980606233b
Merge branch 'fcft-precompose' 2020-05-13 13:03:20 +02:00
Daniel Eklöf
6d0f8e52cb
wayland: force-trigger a resize on 'configured' event
This ensures we _always_ commit a **new** buffer in response to a
configured event.

This fixes an issue in Gnome where e.g. tiling the window (on the
left/right side) only worked if that caused the windows size to
change.
2020-05-12 18:35:28 +02:00
Daniel Eklöf
f156f3f4bd
readme: use unicode RIGHT ARROW instead of '->' 2020-05-10 17:36:15 +02:00
Daniel Eklöf
8d7eab9fb9
readme: short section describing the origins of the name 'foot' 2020-05-10 17:33:48 +02:00
Daniel Eklöf
00df12f1a3
unicode-combine: simplify - remove -Dunicode-precompose option
Since the pre-composing functionality is now part of fcft, it makes
little sense to have a compile time option - there's no size benefit
to be had.

Furthermore, virtually all terminal emulators do
pre-composing (alacritty being an exception), this really isn't that
controversial.
2020-05-10 17:10:33 +02:00
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
77e256763c
readme: unicode-combining: mention when we render the decomposed version 2020-05-09 12:06:11 +02:00
Daniel Eklöf
cce76909c4
meson/PKGBUILD: we now require fcft-2.1.0 2020-05-09 12:06:11 +02:00
Daniel Eklöf
718ba1602a
meson: explicitly define _POSIX_C_SOURCE 2020-05-09 12:06:11 +02:00
Daniel Eklöf
b1b32152c1
unicode-precompose: use fcft's precompose functionality
This allows us more options when determining whether to use a
pre-composed character or not:

We now only use the pre-composed character if it's from the primary
font, or if at least one of the base or combining characters are from
a fallback font.

I.e. use glyphs from the primary font if possible. But, if one or more
of the decomposed glyphs are from a fallback font, use the
pre-composed character anyway.
2020-05-09 12:06:11 +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