aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeLines
* 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
|
* wayland: throttle xdg activation token requests for window urgencyDaniel Eklöf2022-05-11-3/+16
| | | | | | | | | | | | | | | | | When XDG activation support was added to URL mode, we introduced a regression, where it is possible to flood the Wayland socket with XDG activation token requests. Start foot with “foot -o bell.urgency=yes”, then run: while true; do echo -en ‘\a’; done Finally, switch keyboard focus to another window. Foot crashes. Throttle the token requests by limiting the number of outstanding urgency token requests to 1. Closes #1065
* terminal: move viewport when part of it is scrolled outDaniel Eklöf2022-05-11-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | If the viewport is at the top of the scrollback, and a program is scrolling (e.g. by emitting newlines), the viewport needs to be moved. Otherwise, the top of the viewport will show the *bottom* of the scrollback (i.e. the newly emitted lines), and the bottom of the viewport shows the top of the scrollback. How do we detect if the viewport needs to be moved? We convert its absolute row number to a scrollback relative row. This number is also the maximum number of rows we can scroll without the viewport being scrolled out. In other words, if the number of rows to scroll is larger than the viewports scrollback relative row number, the viewport needs to moved. How much do we need to move it? The difference between the number of rows to scroll, and the viewports scrollback relative row number. Example: if the viewport is at the very top of the scrollback, its scrollback relative row number is 0. In this case, it needs to be moved the same number of rows as is being scrolled.
* Themes: Add 'Monokai Pro' themeLorenz2022-05-09-0/+21
| | | Signed-off-by: Lorenz <lorenz@noreply.codeberg.org>
* pgo: add xdg_activation_token parameter to spawn() stubDaniel Eklöf2022-05-06-1/+2
|
* url-mode: add support for XDG activation when opening URLsDaniel Eklöf2022-05-05-69/+209
| | | | | | | | | | | | | | | | | | | | | | | | | First, add a ‘token’ argument to spawn(). When non-NULL, spawn() will set the ‘XDG_ACTIVATION_TOKEN’ environment variable in the forked process. If DISPLAY is non-NULL, we also set DESKTOP_STARTUP_ID, for compatibility with X11 applications. Note that failing to set either of these environment variables are considered non-fatal - i.e. we ignore failures. Next, add a helper function, wayl_get_activation_token(), to generate an XDG activation token, and call a user-provided callback when it’s ‘done (since token generation is asynchronous). This function takes an optional ‘seat’ and ‘serial’ arguments - when both are non-NULL/zero, we set the serial on the token. ‘win’ is a required argument, used to set the surface on the token. Re-write wayl_win_set_urgent() to use the new helper function. Finally, rewrite activate_url() to first try to get an activation token (and spawn the URL launcher in the token callback). If that fails, or if we don’t have XDG activation support, spawn the URL launcher immediately (like before this patch). Closes #1058
* changelog: fix URL in #1047 issue linkDaniel Eklöf2022-04-28-1/+1
|
* commands: fix LOG_DBG() usage in cmd_scrollback_{up,down}Craig Barnes2022-04-27-4/+4
| | | | | | The "end" variable was removed from both of these functions in commit cb43c581508d8, but the references to it in the expansion of LOG_DBG() weren't.
* changelog: add new ‘unreleased’ sectionDaniel Eklöf2022-04-27-0/+11
|
* Merge branch 'releases/1.12'Daniel Eklöf2022-04-27-10/+4
|\
| * meson: bump version to 1.12.11.12.1releases/1.12Daniel Eklöf2022-04-27-1/+1
| |
| * changelog: prepare for 1.12.1Daniel Eklöf2022-04-27-9/+3
| |
| * Merge branch 'master' into releases/1.12Daniel Eklöf2022-04-27-180/+336
| |\ | |/ |/|
* | changelog: changed behavior of “extend-to-word-boundary”Daniel Eklöf2022-04-27-0/+6
| |
* | selection: find_word_boundary_right: add “stop-on-space-to-word-boundary”Daniel Eklöf2022-04-27-10/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When true, selection_find_word_boundary_right() behaves as before - it stops as soon as it encounters a character that isn’t of the same *type* as the “initial” character (the last character in the selection). Take this, for example: The Quick Brown Fox The selection will first stop at the end of “the”, then just *before* “quick”, then at the end of “quick”. Then just *before* “brown”, and then at the end of “brown”, and so on. This suits mouse selections pretty good. But when selection_find_word_boundary_right() is used to extend a search match, it’s better to ignore space-to-word character transitions. That is, we want The Quick Brown Fox to first extend to the end of “the”, then immediately to the end of “quick”, then to the end of “brown”, and so on. Setting the ‘stop_to_space_to_word_boundary’ argument to false results in latter behavior. This is now done by search, when executing the “extend-to-word-boundary” and “extend-to-next-whitespace” key bindings.
* | Disable debug loggingDaniel Eklöf2022-04-27-2/+2
| |
* | term: reset sixel options when hard resetting the terminal stateDaniel Eklöf2022-04-26-0/+12
| |
* | config: add ctrl+shift+v and XF86 paste to SEARCH_CLIPBOARD_PASTEDaniel Eklöf2022-04-26-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | We now bind ctrl+v, ctrl+shift+v, ctrl+y and XF86Paste to pasting from the clipboard into the scrollback search buffer. Why all these? Because we can, and because all are common shortcuts for pasting: * ctrl+v: “normal” apps use this by default * ctrl+shift+v: used in terminals (including foot) * ctrl+y: Emacs * XF86Paste: special keyboard key, for pasting
* | search: fix infinite loop when highlighting all matchesDaniel Eklöf2022-04-26-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | find_next() did not always terminate correctly, causing search_matches_next() to never terminate, which finally leads to an infinite loop when rendering the search overlay surface, while finding all matches to highlight. The problem is that find_next(), after having found the initial matching characters, enters a nested while loop that tries to match the rest of the search criteria. This inner while loop did not check if we’ve reached the last cell, and happily continued past it (eventually wrappping around the scrollback buffer). Closes #1047
* | search: assert that the match is *inside* the new viewportDaniel Eklöf2022-04-26-0/+9
| |
* | search: regression: crash when moving viewportDaniel Eklöf2022-04-26-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5c4ddebc3c57724bd89b959a33f5ad0bd97f482b refactored search_update_selection(), specifically, the logic that moves the viewport. It did so by converting the absolute row number (of the match) to scrollback relative coordinates. This way we could ensure the viewport wasn’t moved “too much” (e.g. beyond the scrollback start). However, grid_row_abs_to_sb() and grid_row_sb_to_abs() doesn’t take a partially filled scrollback into account. This means the row (numbers) it returns may refer to *uninitialized* rows. Since: * The match row itself is valid (we *know* it has text on it) * We *subtract* from it, when setting the new viewport (to center the match on the screen). it’s only the *upper* part of the new viewport that may be uninitialized. I.e. we may have adjusted it too much. So, what we need to do is move the viewport forward until its *first* row is initialized. Then we know the rest will be too.
* | changelog: typo: space on the wrong side of the parenthesisDaniel Eklöf2022-04-26-1/+1
| |
* | Merge branch 'sway-sub-surface-damage-workaround'Daniel Eklöf2022-04-26-2/+19
|\ \ | | | | | | | | | Closes #1046
| * | changelog: workaround for Sway bug #6960Daniel Eklöf2022-04-26-0/+9
| | |
| * | term: flash: work around Sway sub-surface unmap bugDaniel Eklöf2022-04-26-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unmapping a sub-surface in Sway does not damage the underlying surface. As a result, the OSC-555 escape (“flash”) will leave yellow margins on ~every second frame. Out of sway, river, weston and mutter, only Sway needs this workaround. This is a workaround for https://github.com/swaywm/sway/issues/6960 Closes #1046
| * | search: work around Sway sub-surface unmap bugDaniel Eklöf2022-04-26-1/+5
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unmapping a sub-surface in Sway does not damage the underlying surface. As a result, "committing" a scrollback search will typically leave most of the foot window dimmed. It can be seen when "cancelling" a search as well, but there it's less obvious - only the margins are left dimmed. This is because cancelling a search damaged the current viewport (something that shouldn't be needed). Out of sway, river, weston and mutter, only Sway needs this workaround. This is a workaround for https://github.com/swaywm/sway/issues/6960
* | Merge branch 'search-crashes'Daniel Eklöf2022-04-26-151/+167
|\ \ | | | | | | | | | Closes #1036
| * | changelog: search mode not always highlighting all matches correctlyDaniel Eklöf2022-04-26-0/+2
| | |
| * | changelog: crash when extending selection in search modeDaniel Eklöf2022-04-26-0/+2
| | |
| * | search: fix multiple crashesDaniel Eklöf2022-04-25-108/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * When extending the selection to the next word boundary, ensure the row numbers are valid: - use selection_get_end() when retrieving the current end coordinate. This alone fixes a crash where we previously would crash in an out-of-bounds array access in grid->rows[], due to term->selection.coords.end being unbounded. - ensure the new end coordinate is bounded before and after calling selection_find_word_boundary_right(). * When moving the viewport (to ensure a new match is visible), make sure we don’t end up with the match outside the new viewport. Under certain, unusual, circumstances, the moved viewport _still_ did not contain the match. This resulted in assertions triggering later, that assumed the match(es) are *always* visible. It’s fairly easy to trigger this one by running foot with e.g. foot -o scrollback.lines=0 --window-size-chars 25x3 and then hitting enter a couple of times, to fill the scrollback history (which should consist of a single row in the example above), and the do a scrollback search for (part of) the prompt, and keep searching backward until it crashes. This would happen if calculated (new) viewport had to be adjusted (for example, to ensure it didn’t go past the scrollback end). This patch changes the logic used when calculating the new viewport. Instead of calculating the wanted viewport (match is vertically centered) and then trying to adjust it to ensure the new viewport is valid, start with a “safe” new viewport value, and then determine how much we can move it, if at all, to center the match. This is done by using scrollback relative coordinates. In this coordinate system, the new viewport must be >= 0, and < grid->num_lines - term->rows This makes it very easy to limit the amount by which the viewport is adjusted. As a side-effect, we can remove all the old re-adjustment logic. * The match iterator no longer special cases the primary match. This was needed before, when the search iterator did not handle overlapping matches correctly. Now that we do, the iterator is guaranteed to find the primary match, and thus we no longer need to special case it. This fixes a bug where the primary match was returned twice, due to the logic checking if a secondary match is the same as the primary match was flawed... Closes #1036
| * | sixel/terminal: use the new grid and selection APIsDaniel Eklöf2022-04-25-43/+37
| | | | | | | | | | | | | | | | | | | | | Use grid_row_abs_to_sb() instead of manually “rebasing” row numbers. Use selection_get_{start,end}() to retrieve the current selection coordinates.
| * | selection: add start/end coordinate gettersDaniel Eklöf2022-04-25-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | Internally, selection coordinates are *unbounded* (that is, the row numbers may be larger than grid->num_rows) while a selection is ongoing. Only after it has been finalized are the coordinates bounded. This means it isn’t safe to use term->selection.coords.* directly.
| * | grid: add abs-to-sb and sb-to-abs utility functionDaniel Eklöf2022-04-25-0/+33
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These functions convert row numbers between absolute coordinates and “scrollback relative” coordinates. Absolute row numbers can be used to index into the grid->rows[] array. Scrollback relative numbers are ordered with the *oldest* row first, and the *newest* row last. That is, in these coordinates, row 0 is the *first* (oldest) row in the scrollback history, and row N is the *last* (newest) row. Scrollback relative numbers are used when we need to sort things after their age, when determining if something has scrolled out, or when limiting an operation to ensure we don’t go past the scrollback wrap-around.
* | input: assert serial received from compositor is non-zeroDaniel Eklöf2022-04-24-0/+6
| |
* | selection: assert serial is non-zero before copying data to the clipboardDaniel Eklöf2022-04-24-1/+4
| |
* | changelog: scrollback mode freezing, with 100% CPUDaniel Eklöf2022-04-24-0/+2
| |
* | search: matches_next: assert start’s ‘col’ is validDaniel Eklöf2022-04-24-0/+2
| |
* | search: matches_next: stop searching when start.row >= term->rowsDaniel Eklöf2022-04-24-1/+10
| | | | | | | | | | | | | | | | | | As this means the last call to sarch_matches_next() found a match at the bottom of the view, and then set the iter’s *next* start position to a row outside the view. This is fine, but we need to handle it, by immediately stopping the iter.
* | search: matches_next: don’t wrap around grid->num_rowsDaniel Eklöf2022-04-24-2/+6
| | | | | | | | | | | | | | | | | | | | | | When bumping the iter’s start.row, we’re working with view-local coordinates. That is, 0 >= row < term->rows. This means it is wrong to and with grid->num_rows - 1, because a), ‘row’ should **never** be that big. And b), if we do, we’ll just end up in an infinite loop, where the next call to matches_next() just starts over from the beginning again (and eventually hitting the exact same place that got us started).
* | search: maches_next: assert match coordinates are validDaniel Eklöf2022-04-24-0/+9
| | | | | | | | | | * They are within range (i.e. ‘row’ does not exceed term->rows-1) * ‘end’ comes after ‘start’
* | selection: find_word_boundary: assert ‘pos’ is validDaniel Eklöf2022-04-24-0/+10
| |
* | changelog: UI not refreshing when pasting into the scrollback search boxDaniel Eklöf2022-04-24-0/+5
| |
* | render: fix refresh logic of pending csd|search|urlDaniel Eklöf2022-04-24-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our CSDs, the search-box and URL labels are all implemented using sub-surfaces, synchronized with the main grid. This means we *must* commit the main surface as well, when updating one of these sub-surfaces. The logic for doing so in the frame callback was flawed, and only triggered when the main grid was actually dirty. That is, e.g. search box updates that did not also resulted in grid updates (for example - pasting a search criteria that doesn’t match), did not result in a UI refresh. Closes #1040
* | search: fix debug logDaniel Eklöf2022-04-24-1/+2
| | | | | | | | | | This has been broken since the forward/backward search logic was refactored.