aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeLines
* csi: reply with 4 instead of 2 for DECRQM queries of unsupported modesCraig Barnes2022-09-18-44/+61
| | | | | | | | The status value 4 means "permanently reset", as opposed to 2, which means "reset". The former implies that there's no way to enable the mode because it's unsupported (but recognized). Note: this commit also fixes an unrelated typo in CHANGELOG.md.
* config: fix "maybe-uninitialized" error when compiling with CFLAGS=-OgCraig Barnes2022-09-17-0/+3
| | | | | | | | | | | | | | | Using GCC 12.2.0 with the following build steps: CFLAGS=-Og meson bld ninja -C bld ...produces the compiler error: ../config.c:2000:18: error: ‘sym_equal’ may be used uninitialized [-Werror=maybe-uninitialized] This commit fixes that by using BUG() to assert that all possible values are accounted for in the offending switch statement.
* input: pipe-*: set current CWD when spawning the sub-processDaniel Eklöf2022-09-10-1/+5
| | | | Closes #1166
* terminal: don’t unref a not-yet-referenced key-binding setDaniel Eklöf2022-09-06-31/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Key-binding sets are bound to a seat/configuration pair. The conf reference is done when a new terminal instance is created. When that same terminal instance is destroyed, the key binding set is unref:ed. If the terminal instance is destroyed *before* the key binding set has been referenced, we’ll still unref it. This creates an imbalance. In particular, when the there is exactly one other terminal instance referencing that same key binding set, that terminal instance will trigger a foot server crash as soon as it receives a key press/release event. This happens because the next-to-last terminal instance brought the reference count of the binding set down to 0, causing it to be free:d. Thus, we *must* reference the binding set *before* we can error out (when instantiating a new terminal instance). At this point, we don’t yet have a valid terminal instance. But, that’s ok, because all the key_binding_new_for_term() did with the terminal instance was get the "struct wayland" and "struct config" pointers. So, rename the function and simply pass these pointers explicitly. Similarly, change key_binding_for() to take a "struct config" pointer, rather than a "struct terminal" pointer. Also rename key_binding_unref_term() -> key_binding_unref().
* csi: damage *viewport* when exiting the alt screenDaniel Eklöf2022-09-06-1/+1
| | | | | This fixes a redraw issue when the normal screen were somewhere in the scrollback history when exiting the alt screen.
* config: change default ‘pad’ to 0x0 (i.e. no padding)Daniel Eklöf2022-09-03-4/+5
|
* Merge branch 'releases/1.13'Daniel Eklöf2022-08-31-6/+15
|\
| * meson: bump version to 1.13.11.13.1releases/1.13Daniel Eklöf2022-08-31-1/+1
| |
| * changelog: prepare for 1.13.1Daniel Eklöf2022-08-31-9/+3
| |
| * url-mode: connect osc-8 links only when both ID and URI matchesDaniel Eklöf2022-08-31-6/+12
| | | | | | | | | | | | | | | | | | | | | | 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
| * changelog: crash when resizing window, or scrollingDaniel Eklöf2022-08-31-0/+4
| |
| * grid: reflow: assert there aren’t any open URIs on the last rowDaniel Eklöf2022-08-31-0/+15
| |
| * grid: reflow: don’t line-wrap the last rowDaniel Eklöf2022-08-31-21/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * grid: when setting the new viewport, ensure it’s correctly boundedDaniel Eklöf2022-08-31-17/+11
| | | | | | | | | | | | 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.
| * selection: mark_selected_region(): use an enum to encode how the cells are to be updatedDaniel Eklöf2022-08-31-7/+20
| |
| * selection: restore <= 1.12 behavior in block selection wrt empty cellsDaniel Eklöf2022-08-31-1/+3
| | | | | | | | | | That is, highlight empty cells, regardless of whether they’re trailing or not.
| * ci (sr.ht): pull directly from git.sr.htDaniel Eklöf2022-08-31-3/+3
| |
| * selection: once again highlight non-trailing empty cellsDaniel Eklöf2022-08-31-8/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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). 86663522d5915c0fdb2b8b132bacc247fcfd1fb8 “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.
| * selection: never highlight selected, empty cellsDaniel Eklöf2022-08-31-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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). fa2d9f86996467ba33cc381f810ea966a4323381 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 fa2d9f86996467ba33cc381f810ea966a4323381), 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.
| * ci: codespell: ignore ‘zar’ (user who contributed)Daniel Eklöf2022-08-31-3/+3
| |
| * input: ignore pointer motion events on unknown surfacesDaniel Eklöf2022-08-12-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * wayland: #ifdef on XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSIONDaniel Eklöf2022-08-12-0/+8
| | | | | | | | This enables us to compile against wayland-protocols < 1.25
| * render: apply a dimmed overlay while in Unicode input modeDaniel Eklöf2022-08-12-8/+36
| |
| * changelog: add new ‘unreleased’ sectionDaniel Eklöf2022-08-12-0/+11
| |
* | url-mode: connect osc-8 links only when both ID and URI matchesDaniel Eklöf2022-08-30-6/+12
| | | | | | | | | | | | | | | | | | | | | | 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
* | Merge branch 'grid-reflow-viewport-crash-regression'Daniel Eklöf2022-08-30-38/+33
|\ \ | | | | | | | | | Closes #1074
| * | changelog: crash when resizing window, or scrollingDaniel Eklöf2022-08-29-0/+4
| | |
| * | grid: reflow: assert there aren’t any open URIs on the last rowDaniel Eklöf2022-08-29-0/+15
| | |
| * | grid: reflow: don’t line-wrap the last rowDaniel Eklöf2022-08-29-21/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | grid: when setting the new viewport, ensure it’s correctly boundedDaniel Eklöf2022-08-29-17/+11
|/ / | | | | | | | | | | 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.
* | selection: mark_selected_region(): use an enum to encode how the cells are to be updatedDaniel Eklöf2022-08-26-7/+20
| |
* | selection: restore <= 1.12 behavior in block selection wrt empty cellsDaniel Eklöf2022-08-26-1/+3
| | | | | | | | | | That is, highlight empty cells, regardless of whether they’re trailing or not.
* | ci (sr.ht): pull directly from git.sr.htDaniel Eklöf2022-08-23-3/+3
| |
* | selection: once again highlight non-trailing empty cellsDaniel Eklöf2022-08-22-8/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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). 86663522d5915c0fdb2b8b132bacc247fcfd1fb8 “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.
* | theme: change default color theme to solarized-dark-normal-brightsDaniel Eklöf2022-08-22-40/+44
| | | | | | | | | | | | | | | | | | 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".
* | selection: never highlight selected, empty cellsDaniel Eklöf2022-08-22-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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). fa2d9f86996467ba33cc381f810ea966a4323381 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 fa2d9f86996467ba33cc381f810ea966a4323381), 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.
* | config: add setting for underline thicknessYorick Peterse2022-08-20-1/+29
| | | | | | | | | | | | | | | | 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
* | ci: codespell: ignore ‘zar’ (user who contributed)Daniel Eklöf2022-08-20-3/+3
| |
* | input: ignore pointer motion events on unknown surfacesDaniel Eklöf2022-08-12-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | wayland: #ifdef on XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSIONDaniel Eklöf2022-08-12-0/+8
| | | | | | | | This enables us to compile against wayland-protocols < 1.25
* | render: apply a dimmed overlay while in Unicode input modeDaniel Eklöf2022-08-08-8/+36
| |
* | changelog: add new ‘unreleased’ sectionDaniel Eklöf2022-08-07-0/+11
| |
* | Merge branch 'releases/1.13'Daniel Eklöf2022-08-07-6/+9
|\|
| * meson: bump version to 1.13.01.13.0Daniel Eklöf2022-08-07-1/+1
| |
| * changelog: prepare for 1.13.0Daniel Eklöf2022-08-07-5/+8
|/
* grid: get rid of empty row at the bottom after reflowingDaniel Eklöf2022-08-05-0/+22
| | | | | | | | | | | | | | | | | | | | | | | 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
* Add support for xdg_toplevel.wm_capabilitiesSimon Ser2022-08-04-5/+55
| | | | See https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/122
* Add no-op xdg_toplevel.configure_bounds handlerSimon Ser2022-08-03-1/+10
| | | | Next commit uses v5.
* server: Use "normal" socket activation, not inetdMax Gautier2022-07-30-2/+5
| | | | | | | | | | | | | | | | | 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
* config: reset errno before calling getline() againDaniel Eklöf2022-07-29-0/+3
| | | | Related to #1107
* unicode-mode: ‘q’ aborts Unicode input modeDaniel Eklöf2022-07-29-1/+2
|
* unicode-input: move input (key press) handling to unicode_mode_input()Daniel Eklöf2022-07-29-58/+72
|
* input: add new Unicode input modeDaniel Eklöf2022-07-29-2/+167
| | | | | | | | | | | | | | 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
* selection: rework how we update a selectionDaniel Eklöf2022-07-28-106/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* selection: extend: use scrollback relative coordinatesDaniel Eklöf2022-07-28-15/+34
| | | | | | | | | | | | | 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.
* selection: foreach_selected_*(): refactor: use grid_row_abs_to_sb()Daniel Eklöf2022-07-28-6/+5
|
* selection: selection_on_rows(): use scrollback relative coordsDaniel Eklöf2022-07-28-21/+68
| | | | | | | | | | | When checking if the current selection intersects with the region (passed as parameter to the function), use scrollback relative coordinates. This fixes an issue where selections crossing the scrollback wrap-around being misdetected, resulting in either the selection being canceled while scrolling, even though it wasn’t scrolled out, or the selection _not_ being canceled, when it _was_ scrolled out.
* search: find_next(): handle trailing SPACER cellsDaniel Eklöf2022-07-28-0/+5
| | | | | | | | Make sure to increment match_end_col to account for trailing SPACER cells after a match. This fixes an issue where search matches weren’t highlighted correctly when the match *ends* with a double-width character.
* config: add colors.search-box-{no-,}matchDaniel Eklöf2022-07-28-7/+85
| | | | Closes #1112
* test: config: test colors.{jump-labels,scrollback-indicator}Daniel Eklöf2022-07-28-2/+52
|
* input: kitty: always treat composed characters as ‘printable’Daniel Eklöf2022-07-28-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Certain dead key combinations results different escape sequences in foot, compared to kitty, when the kitty keyboard protocol is used. if (composed && is_text) key = utf32; else { key = xkb_keysym_to_utf32(sym_to_use); if (key == 0) return false; /* The *shifted* key. May be the same as the unshifted * key - if so, this is filtered out below, when * emitting the CSI */ alternate = xkb_keysym_to_utf32(sym); } If is_text=false, we’ll fall through to the non-composed logic. is_text is set to true if the character is printable *and* there aren’t any non-consumed modifiers enabled. shift+space is one example where shift is *not* consumed (typically - may be layouts where it is). As a result, pressing ", followed by shift+space with the international english keyboard layout (where " is a dead key) results in different sequences in foot and kitty. This patch fixes this by always treating composed characters as printable. Closes #1120
* keymap: change alt+escape to emit \E\E instead of a CSI 27 sequenceDaniel Eklöf2022-07-28-1/+4
| | | | Closes #1105
* render: it’s unlikely() the current cell is where the cursor isDaniel Eklöf2022-07-28-1/+1
|
* csi: clamp color index for ‘CSI 38/48 ; 5 ; idx m’ sequencesDaniel Eklöf2022-07-22-2/+8
| | | | | | | | | | | | | | Indexed color values are stored in the cell attributes as color indices (into the 256-color table). However, the index from the CSI was not validated in any way, meaning you can do something like this: echo -e ‘\e[38:5:1024m CRASH \e[m’ and foot will crash on an out-of-bounds access. Fix by clamping the color index. Closes #1111
* grid: reflow: require col count > 0 when skipping line truncationDaniel Eklöf2022-06-30-1/+1
| | | | | | | | | | | | | | | | | | When reflowing the grid, we truncate lines with a hard linebreak after the last non-empty cell. This way we don’t reflow trailing empty cells to a new line when resizing the window to a smaller size. However, “logical” lines (i.e. those without a hard linebreak) are *not* truncated. This is to ensure we don’t trim empty cells in the middle of a logical line spanning multiple physical lines. Since newly allocated rows are initialized with linebreak=false, we need to ensure _those_ are still truncated - otherwise all that empty space under the current prompt will be reflowed. Note that this is a temporary workaround. The correct solution, I think, is to track whether a line has been printed to or not, and simply ignore (not reflow) lines that haven’t yet been touched.
* Revert "grid: invert the default value of ‘linebreak’, from false to true"Daniel Eklöf2022-06-30-12/+6
| | | | This reverts commit cdd46cdf85b1087ac7465c646bb05078f1bbe85b.
* input: don’t ignore keyboard enter/leave events when there’s no keymapDaniel Eklöf2022-06-28-6/+3
| | | | | | | | | | | The compositor _usually_ sends the keymap event *before* the enter event. But not always. Not (yet) having a keymap is not a reason to ignore the enter event (now, on the other hand, getting a key press/release event without a keymap is a compositor bug). Closes #1097
* selection: wl_data_offer_set_action: use enum values instead of magic integersDaniel Eklöf2022-06-21-1/+4
|
* selection: reject dnd offers with unsupported mime-typesDaniel Eklöf2022-06-20-0/+4
| | | | | | | We were already doing this, implicitly, *if* the offer was for the main grid. This patch makes it more clear that we do not accept the offer.
* selection: explicitly reject *all* dnd offers not targeting the gridDaniel Eklöf2022-06-20-0/+1
|
* selection: ignore drag-and-drops with unsupported mime-typesDaniel Eklöf2022-06-20-1/+12
| | | | | | | | Specifically, make sure we do *not* call wl_data_offer_receive() with a NULL mime-type, as this causes libwayland to error out, which in turn causes foot to exit. Closes #1092
* shm-formats: #ifdef on formats added in 1.20Daniel Eklöf2022-06-20-0/+4
|
* wayland: log human readable SHM format names in debug buildsDaniel Eklöf2022-06-20-1/+135
|
* key-binding: set BIND_ACTION_KEY_COUNT correctlyDaniel Eklöf2022-06-17-1/+1
| | | | | When the new promp-prev/next bindings were added, we forgot to update BIND_ACTION_KEY_COUNT to reflect this.
* osc: add support for OSC 133;A (prompt markers)Daniel Eklöf2022-06-16-18/+285
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the OSC-133;A sequence, introduced by FinalTerm and implemented by iTerm2, Kitty and more. See https://iterm2.com/documentation-one-page.html#documentation-escape-codes.html. The shell emits the OSC just before printing the prompt. This lets the terminal know where, in the scrollback, there are prompts. We implement this using a simple boolean in the row struct ("this row has a prompt"). The prompt marker must be reflowed along with the text on window resizes. In an ideal world, erasing, or overwriting the cell where the OSC was emitted, would remove the prompt mark. Since we don't store this information in the cell struct, we can't do that. The best we can do is reset it in erase_line(). This works well enough in the "normal" screen, when used with a "normal" shell. It doesn't really work in fullscreen apps, on the alt screen. But that doesn't matter since we don't support jumping between prompts on the alt screen anyway. To be able to jump between prompts, two new key bindings have been added: prompt-prev and prompt-next, bound to ctrl+shift+z and ctrl+shift+x respectively. prompt-prev will jump to the previous, not currently visible, prompt, by moving the viewport, ensuring the prompt is at the top of the screen. prompt-next jumps to the next prompt, visible or not. Again, by moving the viewport to ensure the prompt is at the top of the screen. If we're at the bottom of the scrollback, the viewport is instead moved as far down as possible. Closes #30
* ime: track IME focus independently from keyboard focusDaniel Eklöf2022-06-15-14/+21
| | | | | | | | | | | | | | | | | Replace the seat->ime.focused boolean with a terminal instace pointer, seat->ime_focus. Set and reset this on ime::enter() and ime::leave() events, and use this instead of seat->kbd_focus on all other IME events. This fixes two issues: a) buggy compositors that sometimes sends an IME enter event without first having sent a keyboard enter event. b) seats may be IME capable while still lacking the keyboard capability. Such seats will *always* see IME enter events without a corresponding keyboard enter event.
* ime: ime_reset_pending_{preedit,commit} is not used outside ime.cDaniel Eklöf2022-06-15-36/+34
|
* vt: tag collision-count check with ‘unlikely’Daniel Eklöf2022-06-15-1/+1
|
* vt: improve key calculation for compose sequencesDaniel Eklöf2022-06-15-4/+19
| | | | | | | | | | * Don’t assume 32 bits when rotating the old key. Use the number of actual bits available, as determined by CELL_COMB_CHARS_{HI,LO} * Multiply with magic hash constant This greatly reduces the number of collisions seen. For example, the Emoji test file (from the Unicode specification), now has zero collisions.
* vt: prevent potential endless loop when finding a slot for a composed characterDaniel Eklöf2022-06-15-0/+14
| | | | | | | | | | | | | | | | | | | | | Composed characters are stored in a tree structure, using a key as identifier. The key is calculated from the individual characters that make up the composed character sequence. Since the address space for keys is limited, collisions may occur. In this case, we simply increment the key and try again. It is theoretically possible to saturate the key space, in which case we’ll get stuck in an endless loop. Even if the key space isn’t fully saturated, we fairly easy reach a point where there are so many collisions for each insertion, that performance drops significantly. Since key space is limited (it’s not like a hash table that we can grow), our only option is to limit the number of collisions. If we can’t find a slot within a hard code amount of collisions, the character is simply dropped.
* selection: allow HT, VT and FF, disallow NUL in non-bracketed paste modeDaniel Eklöf2022-06-15-3/+22
| | | | | | | | | | | | | | | | This syncs foot with more recent versions of XTerm, where it’s “disallowedPasteControls” resource has changed its default value to BS,DEL,ENQ,EOT,ESC,NULL Note that we’re already stripping out ENQ,EOT,ESC in all modes. What does it mean for foot: * HT, VT and FF are now allowed, regardless of paste mode * NUL is now stripped in non-bracketed paste mode Closes #1084
* pgo: slave_spawn(): sync function signatureDaniel Eklöf2022-06-13-1/+2
|
* test: config: new test for the new ‘environment’ sectionDaniel Eklöf2022-06-13-0/+37
|
* changelog: new ‘environment’ section in foot.iniDaniel Eklöf2022-06-13-0/+4
|
* doc: document the new ‘environment’ config sectionDaniel Eklöf2022-06-13-4/+23
|
* config: add a new ‘environment’ sectionDaniel Eklöf2022-06-13-4/+63
| | | | | | | | This section allows the user to define custom environment variables to be set in the child process: [environment] name=value
* commands: scroll up: simplify viewport clamping logicDaniel Eklöf2022-06-13-13/+5
| | | | | | | | | | | | | | | | | | When scrolling the viewport up, we need to ensure we don’t go past the scrollback wrap around. This was previously done using “custom” logic that tried to calculate many rows away from the scrollback start the current viewport is. But this is *exactly* what grid_row_abs_to_sb() does, except it doesn’t account for uninitialized scrollback. So, copy the logic from grid_row_abs_to_sb(), but ensure scrollback start points to valid scrollback data. The maximum number of rows we’re allowed to scroll is now the same as the current viewport’s sb-relative coordinate. Maybe closes #1074
* grid: reflow: don’t trim trailing empty cells from logical linesDaniel Eklöf2022-06-11-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | When a line in the old grid (the one being reflowed) doesn’t have a hard linebreak, don’t trim trailing empty cells. Doing so means we’ll “compress” (remove) empty cells between text if/when we revert to a larger window size. The output from neofetch suffers from this; it prints a logo to the left, and system information to the right. The logo and the system info column is separated by empty cells (i.e. *not* spaces). If the window is reduced in size such that the system info is pushed to a new line, each logo line ends with a number of empty cells. The next time the window is resized, these empty cells were ignored (i.e. removed). That meant that once the window was enlarged again, the system info column was a) no longer aligned, and b) had been pulled closer to the logo. This patch doesn’t special case trailing empty cells when the line being reflowed doesn’t have a hard linebreak. This means e.g. ‘ls’ output is unaffected. Closes #1055
* grid: invert the default value of ‘linebreak’, from false to trueDaniel Eklöf2022-06-11-6/+12
|
* Merge branch 'tokyonight'Daniel Eklöf2022-06-01-0/+57
|\
| * Add 'themes/tokyonight-storm'Lorenz2022-06-01-0/+19
| |
| * Add 'themes/tokyonight-night'Lorenz2022-06-01-0/+19
| |
| * Add 'themes/tokyonight-day'Lorenz2022-06-01-0/+19
|/
* themes: add catppuccinStefan Prosiegel2022-05-25-0/+25
|
* config: use $HOME instead of getpwuid() to retrieve users’s home dirDaniel Eklöf2022-05-25-13/+13
| | | | | When searching for foot.ini, use $HOME instead of getpwuid() to retrieve the user’s home directory.
* main: minor rewording of non-UTF8 locale warnings and errorsDaniel Eklöf2022-05-14-6/+6
|
* meson: -Dsystemd-units-dir installs even if systemd is not foundDaniel Eklöf2022-05-12-4/+4
| | | | | If -Dsystemd-units-dir is explicitly set, then install the systemd service files regardless of whether systemd is available or not.
* meson: add -Dsystemd-units-dir=<path> meson command line optionDaniel Eklöf2022-05-12-10/+22
| | | | | | | | | This allows package maintainers to override the location to which our systemd service files are installed. It’s value is an *absolute* path, and *not* relative ${prefix}. The default is ${systemduserunitdir}.
* doc: benchmarks: update with desktop results for 1.12.1 (r9)Daniel Eklöf2022-05-12-13/+13
|
* doc: benchmarks: update with laptop results for 1.12.1 (r9)Daniel Eklöf2022-05-12-13/+13
|