Commit graph

4682 commits

Author SHA1 Message Date
Daniel Eklöf
02fbd0bbce
selection: modify: convert ‘keep_selection’ bitmask from uint64_t to uint8_t 2021-08-16 19:15:52 +02:00
Daniel Eklöf
f0fd3b7578
selection: modify: replace reset_context() macro with a function 2021-08-16 19:15:52 +02:00
Daniel Eklöf
ae70596a50
selection: don’t require two cell attr bits for selection updating
When updating the selection (i.e when changing it - adding or removing
cells to the selection), we need to do two things:

* Unset the ‘selected’ bit on all cells that are no longer selected.
* Set the ‘selected’ bit on all cells that *are* selected.

Since it’s quite tricky to calculate the difference between the “old”
and “new” selection, this is done by first un-selecting the old
selection, and then selecting the new, updated selection. I.e. first
we clear the ‘selected’ bit from *all* cells, and then we re-set it on
those cells that are still selected.

This process also dirties the cells, to make sure they are
re-rendered (needed to reflect their new selected/un-selected status).

To avoid dirtying *all* previously selected, and newly selected cells,
we have used an algorithm that first runs a “pre-pass”, marking all
cells that *will* be selected as such. The un-select pass would then
skip (no dirty) cells that have been marked by the pre-pass. Finally,
the select pass would only dirty cells that have *not* been marked by
the pre-pass.

In short, we only dirty cells whose selection state have *changed*.

To do this, we used a second ‘selected’ bit in the cell attribute
struct.

Those bits are *scarce*.

This patch implements an alternative algorithm, that frees up one of
the two ‘selected’ bits.

This is done by lazy allocating a bitmask for the entire grid. The
pre-pass sets bits in the bitmask. Thus, after the pre-pass, the
bitmask has set bits for all cells that *will* be selected.

The un-select pass simply skips cells with a one-bit in the
bitmask. Cells without a one-bit in the bitmask are dirtied, and their
‘selected’ bit is cleared.

The select-pass doesn’t even have to look at the bitmask - if the cell
already has its ‘selected’ bit set, it does nothing. Otherwise it sets
it and dirties the cell.

The bitmask is implemented as an array of arrays of 64-bit
integers. Each outer element represents one row. These pointers are
calloc():ed before starting the pre-pass.

The pre-pass allocates the inner arrays on demand.

The unselect pass is designed to handle both the complete absence of a
bitmask, as well as row entries being NULL (both means the cell
is *not* pre-marked, and will thus be dirtied).
2021-08-16 19:15:41 +02:00
Daniel Eklöf
647bff22db
Merge branch 'tempus-themes' 2021-08-15 10:35:06 +02:00
Gadzhi Kharkharov
b202eb8444 add tempus themes
rebuild with cursor colors

rebuilt with commented selection colors

rebuild with commented cursor colors
2021-08-15 00:08:41 +03:00
Daniel Eklöf
3daafe9859
Merge branch 'terminfo-remove-keypad'
Closes #670
2021-08-14 21:11:21 +02:00
Daniel Eklöf
f204f09253
changelog: mention keypad application mode keys being removed 2021-08-14 21:10:47 +02:00
Daniel Eklöf
b40aefa50a
changelog: mention km/smm/rmm being removed 2021-08-14 21:08:32 +02:00
Daniel Eklöf
2ff8f59525
terminfo: remove keypad key caps (for keypad application mode)
The keypad application mode gated by private mode 1035. I.e. by
default, there _is_ no keypad application mode in foot.
2021-08-14 21:05:17 +02:00
Daniel Eklöf
572b7d0f96
terminfo: remove km/smm/rmm
By default, foot prefixes Alt-<key> combos with ESC, instead of
setting the 8:th “meta” bit. In this mode, smm/rmm has no effect.

This mode _can_ be disabled, by resetting private mode 1036. However,
the terminfo should reflect the terminal’s *default* behavior.
2021-08-14 21:05:06 +02:00
Daniel Eklöf
807a304306
Merge branch 'pt-or-px-scaling'
Closes #680
2021-08-14 13:00:45 +02:00
Daniel Eklöf
f6f8f2b35e
pt-or-px: heed the dpi-aware setting
Before this patch, pt-or-px values, like letter-spacing, were *always*
scaled using the current DPI value.

This is wrong; if the fonts are scaled using the output’s scaling
factor, then so should all other point values.

This also fixes an issue where e.g. letter-spacing would use one DPI
value at startup, but then when increasing/decreasing or resetting the
font size, would be re-calculated using a different DPI value, leading
to completely different spacing.

This happened when there were multiple monitors, with different DPI
values, and foot guessed the initial DPI value wrong. Normally, foot
would correct itself as soon as the window was mapped, and the
“correct” DPI value known. But if the fonts were scaled using the
scaling factor, it was possible that the font reload never happened.

This patch also updates the thickness calculation (for LIGHT and HEAVY
box drawing characters) to use the scaling factor when appropriate.

Closes #680
2021-08-13 17:38:56 +02:00
Craig Barnes
a37109e5f6 readme: change "32bpp" to "24bpp" in features list
This is somewhat ambiguous, but in a terminal context "True Color"
is usually synonymous with 24-bit RGB (as opposed to 32-bit RGBA).
2021-08-12 13:10:49 +01:00
Daniel Eklöf
7229ddd4ae
Merge branch 'sixel-left-most-column-overwritten' 2021-08-11 18:26:19 +02:00
Daniel Eklöf
41a8f2fc65
render: run the “overflowing glyphs” prepass *before* rendering sixels
This fixes an issue where the left-most column of a sixel was
“overwritten” by the cell content.

This patch also rewrites the prepass logic, to try to reduce the
number of loads performed.

The new logic loops each row from left to right, looking for dirty
cells. When a dirty cell is found, we first scan backwards, until we
find a non-overflowing cell. That cell is unaffected by the
overflowing cell we’re currently dealing with.

We can also stop as soon as we see a dirty cell, since that cell will
already have been dealt with.

Then, we scan forward, dirtying cells until we see a non-overflowing
cell. That first non-overflowing cell is also dirtied, but after that
we break.

The last loop, that scans forward, advances the same cell pointer used
in the outer loop.
2021-08-11 18:26:00 +02:00
Daniel Eklöf
2b14e28512
Merge branch 'uri-characters'
Closes #654
2021-08-11 18:24:25 +02:00
Daniel Eklöf
5ce48a6574
changelog: url.uri-characters 2021-08-09 19:58:40 +02:00
Daniel Eklöf
0c03e9a766
config: add url.uri-characters
This option specifies the characters allowed in the auto-detected
URLs.

Any character not in this set constitutes an URL delimiter, and will
never be included in auto-detected URLs.

This option does not affect OSC-8 URLs.

Closes #654
2021-08-09 18:25:36 +02:00
Daniel Eklöf
f9ba2a8c5c
meson: require meson >= 0.54
We use meson.override_dependency, which was added in 0.54
2021-08-08 10:44:25 +02:00
Daniel Eklöf
cfc73d9fc6
editorconfig: adjust max-line-length, down from 80 to 70 2021-08-07 15:36:19 +02:00
Daniel Eklöf
496f505648
Merge branch 'mouse-wheel-tilt' 2021-08-07 12:28:17 +02:00
Daniel Eklöf
c2cc964116
input: implement support for mouse wheel left/right
We now emit button 6/7 events (when the client application grabs the
mouse). This buttons map to mouse wheel horizontal scroll events. Or, left/right
tilting, if you like.

Wayland report these as ‘axis’ events (just like regular scroll wheel events),
and thus we need to translate those scroll events to button events.

libinput does not define any mouse buttons for wheel tilts, so we add our own
defitions. These are added last in the BTN_* range, just before the BTN_JOYSTICK
events.
2021-08-07 12:27:44 +02:00
Daniel Eklöf
7a372a8c23
Revert "terminfo: add ich1=\E[@"
This reverts commit 76fab8cf69.

See https://codeberg.org/dnkl/foot/issues/668#issuecomment-246149
2021-08-07 12:25:42 +02:00
Daniel Eklöf
460e3b5c57
input: codespell: follwing -> following 2021-08-06 23:08:09 +02:00
Daniel Eklöf
566e083a06
Merge branch 'gnome-drag-workaround' 2021-08-06 22:35:40 +02:00
Daniel Eklöf
a21bf1b4d9
input: workaround GNOME messing up pointer leave/enter after moving window
GNOME doesn’t send pointer enter after finishing a window move.

In subsequent move operations, it is also possible to make it skip sending
pointer leave when starting the move operations.

This caused foot to assert in debug builds, and add the same button multiple
times to the list of buttons currently being pressed.
2021-08-06 22:35:29 +02:00
Daniel Eklöf
a3cd8ebf3c
Merge branch 'terminfo-kmous-xm' 2021-08-06 22:35:03 +02:00
Daniel Eklöf
159ae6cb95
terminfo: change kmous to \E[<, add XM+xm capabilities
ncurses has had a bug where mouse support is completely disabled if the terminfo
didn’t have kmous=\E[M, *or*, the terminfo *name* contained ‘xterm’.

This appears to have been fixed.

Thus, change kmous to \E[<, and set xm/XM accordingly. With this, ncurses
application will use the SGR mouse reporting mode, instead of the legacy
reporting mode.
2021-08-06 22:34:47 +02:00
Daniel Eklöf
69c9662070
Merge branch 'terminfo-ich1' 2021-08-06 22:34:14 +02:00
Daniel Eklöf
76fab8cf69
terminfo: add ich1=\E[@ 2021-08-06 22:33:56 +02:00
Daniel Eklöf
7f62e4398d
Merge branch 'box-drawing-realign-sextants-and-wedges' 2021-08-06 22:30:45 +02:00
Daniel Eklöf
22b280b355
box-drawing: fix compiler warning
../../box-drawing.c: In function 'box_drawing':
../../box-drawing.c:2774:13: error: 'y1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 2774 |     int y0, y1;
      |             ^~
../../box-drawing.c:2774:9: error: 'y0' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 2774 |     int y0, y1;
      |         ^~
2021-08-06 22:29:33 +02:00
Daniel Eklöf
130cf791e9
box-drawing: re-align sextants and wedges
Improve the visual quality of sextants (and wedges) when the cell height isn’t a
multiple of three.
2021-08-06 22:26:49 +02:00
Daniel Eklöf
ea4738c285
Merge branch 'box-drawing-size-optimize' 2021-08-06 22:25:46 +02:00
Daniel Eklöf
6f59186193
box-drawing: don’t inline functions called for multiple codepoints
In several cases, this expanded to multiple calls, and when inlined, resulted in
much larger code size.
2021-08-05 19:51:43 +02:00
Daniel Eklöf
97e64e2caf
box-drawing: wedges: pre-load x_halfs[] and y_thirds[]
This reduces the number of loads in the rest of the function.
2021-08-05 19:51:43 +02:00
Daniel Eklöf
0e10d2b1a2
box-drawing: wedges: avoid floating point math
Re-use the pre-calculated offsets used by the sextants. This is the correct
thing to do since wedges *should* align with sextants.
2021-08-05 19:51:42 +02:00
Daniel Eklöf
950c1b6010
box-drawing: pre-calculate sextant x,y offsets
We’re using floating point math, as a way to ensure that sextant primitives
overlap, rather than leaving empty spaces, or being uneven, when the cell
width/height isn’t divisible with 2 (width) or 3 (height).

This gets rid of all floating point math from the sextant drawing functions.
2021-08-05 19:51:42 +02:00
Daniel Eklöf
469d5abc69
box-drawing: deal with quads in the same as sextants
That is, encode which “pieces” make up each quad in a static array, and use a
single function to draw all quads using the four primitives “upper left/right,
lower left/right”.
2021-08-05 19:51:42 +02:00
Daniel Eklöf
1dcdc42091
box-drawing: don’t inline horizontal-one-eighth-block-N 2021-08-05 19:51:42 +02:00
Daniel Eklöf
67e285f16c
box-drawing: don’t inline light diagional 2021-08-05 19:51:42 +02:00
Daniel Eklöf
29a0c925b7
Merge branch 'box-drawing-wedges'
Closes #474
2021-08-05 19:50:43 +02:00
Daniel Eklöf
36ecd0baed
box-drawing: wedges: fix alignment of inverted wedges
We render the inverted wedges by first rendering a non-inverted triangle, and
then inverting it with PIXMAN_OP_OUT.

In cases where truncating and round():ing the triangle points have different
results, the final, inverted wedge ends up being unaligned with the
corresponding sixel(s).

This patch fixes that by handling the pre-inverted triangles
specifically. I.e. we don’t re-use the same triangle coordinates as the
corresponding non-inverted triangle.
2021-08-05 18:25:01 +02:00
Daniel Eklöf
56d7a51d35
box-drawing: wedges: don’t group similar cases together
Since they’re not exactly alike, we still need branches within each case. Better
to split them up - one case per codepoint.
2021-08-05 18:25:01 +02:00
Daniel Eklöf
1c43fdbea4
box-drawing: add U+1FB3C-U+1FB6F, U+1FB9A and U+1FB9B
These are the “wedges” from the Unicode 13 “Legacy Computing” symbols.

Closes #474
2021-08-05 18:25:01 +02:00
Daniel Eklöf
bdaa9a8991
term: disable debug logging 2021-08-05 18:24:52 +02:00
Daniel Eklöf
347cda14cf
Merge branch 'async-client-termination' 2021-08-03 19:06:29 +02:00
Daniel Eklöf
f1d440e139
term: send SIGTERM/SIGKILL to the entire process group 2021-07-31 22:50:19 +02:00
Daniel Eklöf
98e8778e41
changelog: asynchronous client application termination 2021-07-31 20:13:52 +02:00
Daniel Eklöf
b7edfc2822
term: fix release builds when LOG_ENABLE_DBG=0 2021-07-31 19:52:23 +02:00