Commit graph

5607 commits

Author SHA1 Message Date
Daniel Eklöf
473c5f4e76
Merge branch 'releases/1.13' 2022-08-31 19:26:21 +02:00
Daniel Eklöf
cd1933baf1
meson: bump version to 1.13.1 2022-08-31 19:19:15 +02:00
Daniel Eklöf
864de72b17
changelog: prepare for 1.13.1 2022-08-31 19:17:38 +02:00
Daniel Eklöf
5706141d0a
url-mode: connect osc-8 links only when both ID and URI matches
Before this, two OSC-8 links with a matching ID would be connected
even if their URIs weren’t the same. This is against the spec:

  The same id is only used for connecting character cells whose URIs
  is also the same. Character cells pointing to different URIs should
  never be underlined together when hovering over.

https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#hover-underlining-and-the-id-parameter
2022-08-31 19:16:19 +02:00
Daniel Eklöf
688bf1bd59
changelog: crash when resizing window, or scrolling 2022-08-31 19:16:06 +02:00
Daniel Eklöf
23871d4db5
grid: reflow: assert there aren’t any open URIs on the last row 2022-08-31 19:16:05 +02:00
Daniel Eklöf
22989ef9b3
grid: reflow: don’t line-wrap the last row
Before this patch, we would line-wrap the last row, just like any
other row, and then afterwards try to reverse this, by adjusting the
offset and free:ing and NULL:ing the "last row".

The problem with this is if the scrollback is full. In this case, the
row we’re freeing is the first row in the scrollback history. This
means we’ll crash as soon as the viewport is moved to the top of the
scrollback.

The fix is fairly, simple. Skip the post-processing logic, and instead
detect when we’re line-wrapping the last row, and skip the call to
line_wrap().

This way, the last row in the new grid corresponds to the last row in
the old grid.
2022-08-31 19:16:04 +02:00
Daniel Eklöf
649d56a4e5
grid: when setting the new viewport, ensure it’s correctly bounded
Do this by using scrollback relative coordinates, and ensure the new
viewport is not larger than (grid_rows - screen_rows), as that would
mean the viewport crosses the scrollback wrap-around.
2022-08-31 19:16:02 +02:00
Daniel Eklöf
d810e4fc8e
selection: mark_selected_region(): use an enum to encode how the cells are to be updated 2022-08-31 19:15:54 +02:00
Daniel Eklöf
2354298eca
selection: restore <= 1.12 behavior in block selection wrt empty cells
That is, highlight empty cells, regardless of whether they’re trailing
or not.
2022-08-31 19:15:51 +02:00
Daniel Eklöf
03d3887e6b
ci (sr.ht): pull directly from git.sr.ht 2022-08-31 19:15:48 +02:00
Daniel Eklöf
6f1cf6fc56
selection: once again highlight non-trailing empty cells
Foot 1.13.0 introduced a regression where non-trailing empty cells
were highlighted inconsistently (cells that shouldn’t be highlighted,
were, seemingly at random).

86663522d5 “fixed” this by never
highlighting *any* empty cells.

This meant the behavior, compared to foot 1.12 and earlier,
changed. In foot 1.12 and older versions, non-trailing empty cells
were highlighted, as long as the selection covered at least one of the
trailing non-empty cells.

This patch restores that behavior.

To understand how this works, lets first take a look at how selection
works:

When a selection is made, and updated (i.e. the mouse is dragged, or
the selection is extended through RMB etc), we need to (un)tag and dirty
the cells that are a) newly selected, or b) newly deselected. That is,
we look at the diff between the “old” and the “new” selection, and
only update those cells.

This is for performance reasons: iterating the entire selection is not
feasible with large selections. However, it also means we cannot
reason about empty cells; we simply don’t know if an empty cells is a
trailing empty cell, or a non-trailing one.

Then, when we render a frame, we iterate all the *visible*
and *selected* cells, once again tagging them as selected (this is
needed since a selected cell might have lost its selected tag if the
cell was written to, by the client application, after the selection
was made).

At this point, we *can* reason about empty cells.

So, to restore the highlighting behavior to that of foot 1.12, we do
this:

When working with the selection diffs when a selection is updated, we
don’t special case empty cells at all. Thus, all empty cells covered
by the selection is highlighted, and dirtied.

But, when rendering the frame, we _do_ special case them. The only
difference (compared to foot 1.12) is that we *must*
explicitly *clear* the selection tag, and dirty the empty cells. This
is to ensure the empty cells that were incorrectly highlighted by the
selection update algorithm, isn’t rendered as that.

This does have a slight performance impact, as empty cells are now
always re-rendered. The impact should however be small.
2022-08-31 19:15:44 +02:00
Daniel Eklöf
736babcdbc
selection: never highlight selected, empty cells
This fixes a regression, where empty cells "between" non-empty
cells (i.e. non-trailing empty cells) sometimes were incorrectly
highlighted.

The idea has always been to highlight exactly those cells that will
get extracted when they’re copied. This means we’ve not highlighted
trailing empty cells, but we _have_ highlighted other empty cells,
since they are converted to spaces when copied (whereas trailing empty
cells are skipped).

fa2d9f8699 changed how a selection is
updated. That is, which cells gets marked as selected, and which ones
gets unmarked.

Since we no longer walk all the cells, but instead work with pixman
regions representing selection diffs, we can no longer determine (with
certainty) which empty cells should be selected and which shouldn’t.

Before this patch (but after
fa2d9f8699), we sometimes incorrectly
highlighted empty cells that should not have been highlighted. This
happened when we’ve first (correctly) highlighted a region of empty
cells, but then shrink the selection such that all those empty cells
should be de-selected.

This patch changes the selection behavior to *never* highlight empty
cells. This fixes the regression, but also means slightly different
behavior, compared to pre-fa2d9f86996467ba33cc381f810ea966a4323381.

The other alternative is to always highlight all empty cells. But,
since I personally like the fact that we’re skipping trailing empty
cells, I prefer the approach taken by this patch.
2022-08-31 19:14:18 +02:00
Daniel Eklöf
ccef435736
ci: codespell: ignore ‘zar’ (user who contributed) 2022-08-31 19:14:03 +02:00
Daniel Eklöf
c753cf8f45
url-mode: connect osc-8 links only when both ID and URI matches
Before this, two OSC-8 links with a matching ID would be connected
even if their URIs weren’t the same. This is against the spec:

  The same id is only used for connecting character cells whose URIs
  is also the same. Character cells pointing to different URIs should
  never be underlined together when hovering over.

https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#hover-underlining-and-the-id-parameter
2022-08-30 17:55:14 +02:00
Daniel Eklöf
4dd63bcc91
Merge branch 'grid-reflow-viewport-crash-regression'
Closes #1074
2022-08-30 17:52:55 +02:00
Daniel Eklöf
524474728a
changelog: crash when resizing window, or scrolling 2022-08-29 21:04:56 +02:00
Daniel Eklöf
454c82f0f5
grid: reflow: assert there aren’t any open URIs on the last row 2022-08-29 21:03:21 +02:00
Daniel Eklöf
5c86358cd1
grid: reflow: don’t line-wrap the last row
Before this patch, we would line-wrap the last row, just like any
other row, and then afterwards try to reverse this, by adjusting the
offset and free:ing and NULL:ing the "last row".

The problem with this is if the scrollback is full. In this case, the
row we’re freeing is the first row in the scrollback history. This
means we’ll crash as soon as the viewport is moved to the top of the
scrollback.

The fix is fairly, simple. Skip the post-processing logic, and instead
detect when we’re line-wrapping the last row, and skip the call to
line_wrap().

This way, the last row in the new grid corresponds to the last row in
the old grid.
2022-08-29 20:47:33 +02:00
Daniel Eklöf
13281f327b
grid: when setting the new viewport, ensure it’s correctly bounded
Do this by using scrollback relative coordinates, and ensure the new
viewport is not larger than (grid_rows - screen_rows), as that would
mean the viewport crosses the scrollback wrap-around.
2022-08-29 20:46:19 +02:00
Daniel Eklöf
d5df86f785
selection: mark_selected_region(): use an enum to encode how the cells are to be updated 2022-08-26 21:07:20 +02:00
Daniel Eklöf
db2737b96a
selection: restore <= 1.12 behavior in block selection wrt empty cells
That is, highlight empty cells, regardless of whether they’re trailing
or not.
2022-08-26 17:48:00 +02:00
Daniel Eklöf
4f06d413e2
ci (sr.ht): pull directly from git.sr.ht 2022-08-23 16:38:39 +02:00
Daniel Eklöf
21ab16239d
selection: once again highlight non-trailing empty cells
Foot 1.13.0 introduced a regression where non-trailing empty cells
were highlighted inconsistently (cells that shouldn’t be highlighted,
were, seemingly at random).

86663522d5 “fixed” this by never
highlighting *any* empty cells.

This meant the behavior, compared to foot 1.12 and earlier,
changed. In foot 1.12 and older versions, non-trailing empty cells
were highlighted, as long as the selection covered at least one of the
trailing non-empty cells.

This patch restores that behavior.

To understand how this works, lets first take a look at how selection
works:

When a selection is made, and updated (i.e. the mouse is dragged, or
the selection is extended through RMB etc), we need to (un)tag and dirty
the cells that are a) newly selected, or b) newly deselected. That is,
we look at the diff between the “old” and the “new” selection, and
only update those cells.

This is for performance reasons: iterating the entire selection is not
feasible with large selections. However, it also means we cannot
reason about empty cells; we simply don’t know if an empty cells is a
trailing empty cell, or a non-trailing one.

Then, when we render a frame, we iterate all the *visible*
and *selected* cells, once again tagging them as selected (this is
needed since a selected cell might have lost its selected tag if the
cell was written to, by the client application, after the selection
was made).

At this point, we *can* reason about empty cells.

So, to restore the highlighting behavior to that of foot 1.12, we do
this:

When working with the selection diffs when a selection is updated, we
don’t special case empty cells at all. Thus, all empty cells covered
by the selection is highlighted, and dirtied.

But, when rendering the frame, we _do_ special case them. The only
difference (compared to foot 1.12) is that we *must*
explicitly *clear* the selection tag, and dirty the empty cells. This
is to ensure the empty cells that were incorrectly highlighted by the
selection update algorithm, isn’t rendered as that.

This does have a slight performance impact, as empty cells are now
always re-rendered. The impact should however be small.
2022-08-22 20:14:06 +02:00
Daniel Eklöf
3cf11bfea9
theme: change default color theme to solarized-dark-normal-brights
This is my variant of the solarized theme, were only the first eight
colors (i.e. the "normal") colors are from the solarized theme. The
remaining eight (the "bright" colors) are brightened versions of the
"normal" colors. This results in a theme that is usually in all
applications, not just those that are "aware" that the terminal color
theme is "solarized".
2022-08-22 13:37:12 +02:00
Daniel Eklöf
86663522d5
selection: never highlight selected, empty cells
This fixes a regression, where empty cells "between" non-empty
cells (i.e. non-trailing empty cells) sometimes were incorrectly
highlighted.

The idea has always been to highlight exactly those cells that will
get extracted when they’re copied. This means we’ve not highlighted
trailing empty cells, but we _have_ highlighted other empty cells,
since they are converted to spaces when copied (whereas trailing empty
cells are skipped).

fa2d9f8699 changed how a selection is
updated. That is, which cells gets marked as selected, and which ones
gets unmarked.

Since we no longer walk all the cells, but instead work with pixman
regions representing selection diffs, we can no longer determine (with
certainty) which empty cells should be selected and which shouldn’t.

Before this patch (but after
fa2d9f8699), we sometimes incorrectly
highlighted empty cells that should not have been highlighted. This
happened when we’ve first (correctly) highlighted a region of empty
cells, but then shrink the selection such that all those empty cells
should be de-selected.

This patch changes the selection behavior to *never* highlight empty
cells. This fixes the regression, but also means slightly different
behavior, compared to pre-fa2d9f86996467ba33cc381f810ea966a4323381.

The other alternative is to always highlight all empty cells. But,
since I personally like the fact that we’re skipping trailing empty
cells, I prefer the approach taken by this patch.
2022-08-22 13:35:52 +02:00
Yorick Peterse
a0942f950d
config: add setting for underline thickness
This adds an "underline-thickness" setting to the "main" section,
similar to the existing "underline-offset" setting. This setting is used
to specify a custom height for regular (= non-cursor) underlines.

Fixes #1136
2022-08-20 22:16:32 +02:00
Daniel Eklöf
65ecb77737
ci: codespell: ignore ‘zar’ (user who contributed) 2022-08-20 18:25:05 +02:00
Daniel Eklöf
20b8ca1601
input: ignore pointer motion events on unknown surfaces
In some cases, the compositor sends a pointer enter event with a NULL
surface. It’s unclear if this is a compositor bug, or a race (where
the compositor sends an enter event on a CSD surface at the same time
foot unmaps the CSDs). Regardless, this causes seat->mouse_focus to be
unset, which triggers a crash in foot on the next pointer motion
event.

This patch does two things:

a) log a warning when we receive a pointer event with a NULL surface
b) ignore motion events where seat->mouse_focus is NULL
2022-08-12 16:15:55 +02:00
Daniel Eklöf
5697348b46
wayland: #ifdef on XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION
This enables us to compile against wayland-protocols < 1.25
2022-08-12 16:15:53 +02:00
Daniel Eklöf
1cf22846a0
render: apply a dimmed overlay while in Unicode input mode 2022-08-12 16:15:50 +02:00
Daniel Eklöf
157b64098a
changelog: add new ‘unreleased’ section 2022-08-12 16:15:47 +02:00
Daniel Eklöf
45803791cf
input: ignore pointer motion events on unknown surfaces
In some cases, the compositor sends a pointer enter event with a NULL
surface. It’s unclear if this is a compositor bug, or a race (where
the compositor sends an enter event on a CSD surface at the same time
foot unmaps the CSDs). Regardless, this causes seat->mouse_focus to be
unset, which triggers a crash in foot on the next pointer motion
event.

This patch does two things:

a) log a warning when we receive a pointer event with a NULL surface
b) ignore motion events where seat->mouse_focus is NULL
2022-08-12 16:13:25 +02:00
Daniel Eklöf
eafff70439
wayland: #ifdef on XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION
This enables us to compile against wayland-protocols < 1.25
2022-08-12 16:12:36 +02:00
Daniel Eklöf
e249b52abd
render: apply a dimmed overlay while in Unicode input mode 2022-08-08 16:31:28 +02:00
Daniel Eklöf
a36848a4ad
changelog: add new ‘unreleased’ section 2022-08-07 09:38:25 +02:00
Daniel Eklöf
8b6e6f1073
Merge branch 'releases/1.13' 2022-08-07 09:38:01 +02:00
Daniel Eklöf
e0465d3a7a
meson: bump version to 1.13.0 2022-08-07 09:32:02 +02:00
Daniel Eklöf
e3eefdacde
changelog: prepare for 1.13.0 2022-08-07 09:31:56 +02:00
Daniel Eklöf
aaf5894ad9
grid: get rid of empty row at the bottom after reflowing
When the window is resized and we reflow the text, we ended up
inserting an empty row at the bottom.

This happens whenever the actual last row has a hard linebreak (which
almost always is the case); we then end the reflow with a line break,
causing an extra, empty, row to be allocated and inserted.

This patch fixes this by detecting when:

1) the last row is empty
2) the next to last row has a hard line break

In this case, we roll back the last line break, by adjusting the new
offset we just calculated, and free:ing the empty row.

TODO: it would be nice if we could detect this in the reflow loop
instead, and avoid doing the last line break all together. I haven’t
yet been able to find a way to do this correctly.

Closes #1108
2022-08-05 18:26:37 +02:00
Simon Ser
129e1a9b8e Add support for xdg_toplevel.wm_capabilities
See https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/122
2022-08-04 14:23:03 +02:00
Simon Ser
2f68b421bf Add no-op xdg_toplevel.configure_bounds handler
Next commit uses v5.
2022-08-03 13:50:13 +02:00
Max Gautier
ffdac61e2a
server: Use "normal" socket activation, not inetd
Systemd, when doing socket activation, pass file descriptors in a
non-stable order when there is multiples ones.

But we only use one, so we don't need to identify it, and the file
descriptors always start at 3.
So use 3 for the systemd service.

Source : sd_listen_fds (systemd man pages)

We also need to unset variables systemd pass to socket activated
process, since we don't need them and sub-process (footclient and
theirs forks) could be confused by those.

Closes #1107
2022-07-30 15:13:56 +02:00
Daniel Eklöf
c0a7c7bf0d
config: reset errno before calling getline() again
Related to #1107
2022-07-29 21:27:27 +02:00
Daniel Eklöf
0cbd99710b
unicode-mode: ‘q’ aborts Unicode input mode 2022-07-29 11:56:41 +02:00
Daniel Eklöf
001f96c4e3
unicode-input: move input (key press) handling to unicode_mode_input() 2022-07-29 09:26:42 +02:00
Daniel Eklöf
8967dd9cfe
input: add new Unicode input mode
This mode is activated through the new key-bindings.unicode-input and
search-bindings.unicode-input key bindings.

When active, the user can “build” a Unicode codepoint by typing its
hexadecimal value.

Note that there’s no visual feedback in this mode. This is
intentional. This mode is intended to be a fallback for users that
don’t use an IME.

Closes #1116
2022-07-29 09:26:31 +02:00
Daniel Eklöf
fa2d9f8699
selection: rework how we update a selection
Before this patch, each selection update would result in grid covered
by the selection being walked *three* times. First to “premark” the
area that *will* be selected after the update, then again to unmark
the previous selection (excluding the cells that were premarked - but
the cells are still iterated), and then one more time to finalize the
selection state in the grid.

Furthermore, each time a frame is rendered, the entire selection were
iterated again, to ensure all the cells have their ‘selected’ bit
set.

This quickly gets *very* slow.

This patch takes a completely different approach. Instead of looking
at the selection as a range of cells to iterate, we view it as an
area, or region. Thus, on each update, we have to regions: the region
representing the previous selection, and the region representing the
to-be selection.

By diffing these two regions, we get two new regions: one that
represents the cells that were selected, but aren’t any more, and one
that represents the cells that previously were not selected, but now
will be.

We implement the regions using pixman regions. By subtracting the
current selection from the previous selection, we get the region
representing the cells that are no longer selected, and that should be
unmarked.

By subtracting the previous selection from the current, we get the
region representing the cells that was added to the selection in this
update, and that should be marked.

selection_dirty_cells() is rewritten in a similar manner. We create
pixman regions for the selection, and the current scrollback view. The
intersection represents the (selected) cells that are visible. These
need to iterated and marked as being selected.

Closes #1114
2022-07-28 21:06:58 +02:00
Daniel Eklöf
b8506bbea0
selection: extend: use scrollback relative coordinates
When extending a selection, we determine *how* to extend it (which
endpoint to move, and whether to grow or shrink the selection) by
comparing the extension point with the old start and end coordinates.

For this to work correctly, we need to use scrollback relative
coordinates.

This fixes an issue where extending a very large selection (covering
many pages) sometimes shrunk the selection instead of growing it, or
just misbehaving in general.
2022-07-28 21:06:58 +02:00
Daniel Eklöf
6ebf55572e
selection: foreach_selected_*(): refactor: use grid_row_abs_to_sb() 2022-07-28 21:06:58 +02:00