aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeLines
...
* render: minimum window size: 2 cols -> 1 colDaniel Eklöf2025-02-10-1/+1
|
* grid: reflow: don't special case the first cell in a multi-column characterDaniel Eklöf2025-02-10-54/+56
| | | | | | | | Wrap *all* cell copying logic in a for-loop for the characters width. This _should_, in theory, mean reflow of e.g. cursor coordinates in the middle of a multi-column character works correctly. Also fix reflow of cmd start/end integration.
* grid: performance: check for non-NULL before comparing with terminatorDaniel Eklöf2025-02-10-2/+2
| | | | | This should be slightly faster in the normal(?) case (no styled underlines or OSC-8).
* grid: refactor reflowDaniel Eklöf2025-02-10-151/+88
| | | | | | | | | | | | We've been trying to performance optimize reflow by "chunking" cells; try to gather as many as possible, and memcpy a chunk at once. The problem is that a) this quickly becomes very complex, and b) is very hard to get right for multi-column characters, especially when we need to truncate long ones due to the window being too small. Refactor, and once again walk and copy all cells one by one. This is slower, but at least it's correct.
* url-mode: regex: don't try to NULL-terminate an invalid vlineDaniel Eklöf2025-02-10-1/+4
|
* doc: foot.ini: fix 'hashes' regex exampleDaniel Eklöf2025-02-10-2/+2
| | | | It's A-F, not A-f
* forgejo: better names for templatesDaniel Eklöf2025-02-10-0/+0
|
* grid: pull in misc.h when TIME_REFLOW is definedDaniel Eklöf2025-02-10-0/+4
|
* url-mode: terminate last virtual line before regex matchingDaniel Eklöf2025-02-10-1/+5
| | | | | If the last line doesn't have a hard linebreak, it was never NULL terminated, causing regexec() to crash on an out-of-bounds access.
* Fix URL detection regression on lines with NUL bytesJohannes Altmanninger2025-02-10-1/+2
| | | | | | | | | | | | Commit 859b4c89 (url-mode: wip: more work on regex matching, 2025-01-30) regressed URL detection in weechat. Some of the URLs still work but others don't. This is because regexec() stops at the first NUL, thus skipping the rest of the line. weechat seems create NUL cells between their UI widgets. Work around this by replacing NUL with space. This is probably correct because selecting and copying those cells also translates to space (not sure where in the code).
* config: regex: fix invalid freeDaniel Eklöf2025-02-10-1/+1
| | | | | | | | | Zero-initialize the 'launch' spawn template before calling value_to_spawn_template(). This is needed since value_to_spawn_template() tries to free the old value before assigning the new one. Closes #1951
* Merge branch 'text-width-protocol'Daniel Eklöf2025-02-06-333/+514
|\
| * changelog: text-sizing protocolDaniel Eklöf2025-02-06-1/+2
| |
| * render: resize: note why min_cols=7Daniel Eklöf2025-02-06-1/+1
| |
| * grid: reflow: get number of spacers to insert from the old gridDaniel Eklöf2025-02-06-1/+1
| | | | | | | | | | | | | | | | When checking if we're breaking in the middle of a multi-column character, we counted spacers starting from the break point. But, the character may be wider than that. Use the fact that the spacers cells encode how many *more* there are after them; when we get to the first one, we know exactly how wide the character is.
| * term: print-non-ascii: propagate existing forced-widthDaniel Eklöf2025-02-06-2/+2
| | | | | | | | | | | | | | | | | | | | | | When appending to an existing composed character, "inherit" its forced width, if set. Also make sure to actually _use_ the forced width, if set, rather than the calculated width. This fixes an issue when appending zero-width codepoints to a forced-width combining character.
| * osc: text-size: disable optimizationDaniel Eklöf2025-02-06-0/+2
| | | | | | | | | | | | The optimization prevents the forced-width to be set on the new combining character, causing issues when followed by more zero-width codepoints.
| * doc: ctlseq: add OSC 66 (kitty text sizing)Daniel Eklöf2025-02-06-1/+4
| |
| * composed: codespell: infinitelyDaniel Eklöf2025-02-06-1/+1
| |
| * osc: text-sizing: implement w=0, plus optimize single-codepoint casesDaniel Eklöf2025-02-06-4/+51
| | | | | | | | | | | | | | | | | | | | If there's a single codepoint in the text portion of the OSC sequence, and its calculated width matches the forced width, print it directly to the grid instead of emitting a combining character. When w=0, we split up the text string "as we normally would". Since we don't support any other text-sizing parameters, this means simply printing each codepoint to the grid.
| * term+vt: refactor: move "utf8" char processing to term_process_and_print_non_ascii()Daniel Eklöf2025-02-06-251/+261
| | | | | | | | | | | | | | | | | | | | | | This function "prints" any non-ascii character (i.e. any character that ends up in the action_utf8_print() function in vt.c) to the grid. This includes grapheme cluster processing etc. action_utf8_print() now simply calls this function. This allows us to re-use the same functionality from other places (like the text-sizing protocol).
| * osc: wip: kitty text size protocolDaniel Eklöf2025-02-06-14/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This brings initial support for the new kitty text-sizing protocol. Note hat only the width-parameter ('w') is supported. That is, no font scaling, and no multi-line cells. For now, only explicit widths are supported. That is, w=0 does not yet work. There are a couple of changes to the renderer, to handle e.g. OSC 66 ; w=6 ; foobar ST There are two ways this can get rendered, depending on whether grapheme shaping has been enabled. We either shape it, and get an array of glyphs back that we render. Or, we rasterize each codepoint ourselves, and render each resulting glyph. The two cases ends up in two different renderer loops, that worked somewhat different. In particular, the first case has probably never been tested/used at all... With this patch, both are changed, and now uses some heuristic to differentiate between multi-cell text strings (like in the example above), or single-cell combining characters. The difference is mainly in which offset to use for the secondary glyphs. In a multi-cell string, each glyph is mapped to its own cell, while in the combining case, we try to map all glyphs to the same cell.
| * grid: reflow: handle composed characters longer than 2 cellsDaniel Eklöf2025-02-06-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The logic that tries to ensure we don't break a line in the middle of a multi-cell character was flawed when the number of cells were larger than 2. In particular, if the number of cells to copy were limited by the number of cells left on the current (new) line, and were less than the length of the multi-cell character, then we failed to insert the correct number of spacers, and also ended up misplacing the multi-cell character; instead of pushing it to the next line, it was inserted on the current line, even though it doesn't fit. Also change how trailing SPACER cells are rendered (cells that are "fillers" at then end of a line, when a multi-column character was pushed over to the next line): don't copy the previous cell's attributes (which may be wrong anyway), use default attributes instead.
| * composed: refactor: break out lookup with collision detectionDaniel Eklöf2025-02-06-53/+54
| |
| * composed: re-factor: break out key calculation from vt.cDaniel Eklöf2025-02-06-22/+51
|/
* term: insert-mode: handle combining characters correctlyDaniel Eklöf2025-02-06-6/+14
| | | | | | | | | | | | | | | | | When the client application emits combining characters, for example multi-codepoint emojis, in insert-mode, we ended up pushing partial graphemes to the right, for each codepoint, resulting in too many cells (and with the wrong content) being inserted. The fix is fairly simple; don't "insert" when appending characters to an existing grapheme cluster. This isn't something we can detect easily in print_insert() (it would require us to do grapheme clustering again). Fortunately, we do have the required information in action_utf8_print(). So, pass this information as a boolean to term_print(). Closes #1947
* Merge branch 'regex-mode'Daniel Eklöf2025-02-05-413/+593
|\ | | | | | | | | Closes #1386 Closes #1872
| * changelog: custom regex'sDaniel Eklöf2025-02-05-0/+5
| |
| * doc: regex: custom regex's aren't URLsDaniel Eklöf2025-02-05-4/+4
| |
| * doc: improve regex exampleDaniel Eklöf2025-02-05-10/+11
| |
| * spawn template variables are on the form ${}, not {}Daniel Eklöf2025-02-05-3/+3
| |
| * url-mode: use the first *sub* expression as URLDaniel Eklöf2025-02-05-28/+51
| | | | | | | | | | | | | | | | When auto-matching URLs (or custom regular expressions), use the first *subexpression* as URL, rather than the while regex match. This allows us to write custom regular expressions with prefix/suffix strings that should not be included in the presented match.
| * config: remove debug loggingDaniel Eklöf2025-02-05-2/+0
| |
| * tests: config: handle regex key bindingsDaniel Eklöf2025-02-05-8/+28
| |
| * doc: foot.ini: document custom regular expressionsDaniel Eklöf2025-02-05-1/+57
| |
| * foot.ini: improve documentation of custom regexDaniel Eklöf2025-02-05-0/+8
| |
| * config+url: add support for user-defined regex patternsDaniel Eklöf2025-02-05-48/+310
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Users can now define their own regex patterns, and use them via key bindings: [regex:foo] regex=foo(bar)? launch=path-to-script-or-application {match} [key-bindings] regex-launch=[foo] Control+Shift+q regex-copy=[foo] Control+Mod1+Shift+q That is, add a section called 'regex:', followed by an identifier. Define a regex and a launcher command line. Add a key-binding, regex-launch and/or regex-copy (similar to show-urls-launch and show-urls-copy), and connect them to the regex with the "[regex-name]" syntax (similar to how the pipe-* bindings work).
| * xmalloc: calling xrealloc() or xreallocarray() with a 0-size is UB in C23Daniel Eklöf2025-02-05-2/+4
| | | | | | | | And likely to in future POSIX too.
| * url-mode: regex: make sure there's always room for the NULL terminatorDaniel Eklöf2025-02-05-1/+2
| |
| * foot.ini+doc: add default value of url.regexDaniel Eklöf2025-02-05-2/+4
| |
| * url-mode+config: wip: add url.regex optionDaniel Eklöf2025-02-05-54/+76
| |
| * config: remove url.{uri-characters,protocols}Daniel Eklöf2025-02-05-178/+7
| |
| * url-mode: wip: regex: tweak debug log messageDaniel Eklöf2025-02-05-2/+2
| |
| * url-mode: wip: regex: mention changes from original regexDaniel Eklöf2025-02-05-1/+5
| |
| * url-mode: wip: regex: don't allow {}, do allow matched []Daniel Eklöf2025-02-05-3/+7
| |
| * url-mode: wip: more work on regex matchingDaniel Eklöf2025-02-05-286/+75
| | | | | | | | Remove the old auto-detection and instead use the regex matches.
| * url-mode: wip: convert to regex matching for auto-detectionDaniel Eklöf2025-02-05-0/+145
| |
| * grid: typoDaniel Eklöf2025-02-05-1/+2
| |
| * xmalloc: add xreallocarray()Daniel Eklöf2025-02-05-0/+8
|/
* box-drawings: handle architecture with soft-floatThomas Bonnefille2025-02-05-3/+1
| | | | | | | | | | | | Currently, architecture using soft-floats doesn't support instructions FE_INVALID, FE_DIVBYZERO, FE_OVERFLOW and FE_UNDERFLOW and so building on those architectures results with a build error. As the sqrt math function should set errno to EDOM if an error occurs, fetestexcept shouldn't be mandatory. This commit removes the float environment error handling. Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
* server: don't instantiate a client without a monitorsewn2025-02-05-0/+6
|
* term: ptmx pause/resume: don't modify the FDM if ptmx has been closedDaniel Eklöf2025-02-05-0/+4
| | | | | This fixes error message spam when resizing a terminal window executed with --hold, and where the client application has terminated.
* Revert "forgejo: server/standalone: what happens when we set required=true?"Daniel Eklöf2025-02-04-2/+0
| | | | This reverts commit 70aa033d7912b978264d035b095b25090ff00f07.
* forgejo: server/standalone: what happens when we set required=true?Daniel Eklöf2025-02-04-0/+2
|
* forgejo: remind user to sanitize pasted configDaniel Eklöf2025-02-04-1/+1
|
* forgejo: server/standalone: tweak wordingDaniel Eklöf2025-02-04-3/+3
|
* forgejo: issue happens in foot --server, standalone, or both?Daniel Eklöf2025-02-04-0/+8
|
* forgejo: ask user to provide distro *version*, when applicableDaniel Eklöf2025-02-04-2/+2
|
* input: match unshifted key-bindings before shiftedDaniel Eklöf2025-01-31-42/+42
| | | | | | | | | | | | | | | | | | | | That is, try to match e.g. Control+shift+a, before trying to match Control+A. In most cases, order doesn't matter. There are however a couple of symbols where the layout consumes the shift-modifier, and the generated symbol is the same in both the shifted and unshifted form. One such example is backspace. Before this patch, key-bindings with shift-backspace would be ignored, if there were another key-binding with backspace. So, for example, if we had one key-binding with Control+Backspace, and another with Control+Shift+Backspace, the latter would never trigger, as we would always match the first one. By checking for unshifted matches first, we ensure Control+Shift+Backspace does match.
* input: ignore key-bindings without modifiers when matching untranslated/rawDaniel Eklöf2025-01-31-6/+6
| | | | | | | | | When matching the unshifted symbol, or the raw key code, ignore all key bindings that don't have any modifiers. This fixes an issue where it was impossible to enter (some of the) numbers on the keypad, **if** there was a key-binding for e.g. KP_Page_Up, or KP_Page_Down.
* key-bindings: add keypad variants to existing default key-bindingsDaniel Eklöf2025-01-31-10/+18
|
* input: close fd on no/unrecognized keymap formatAttila Fidan2025-01-30-0/+4
|
* forgejo: config: render as .ini, instead of the default markdownDaniel Eklöf2025-01-27-0/+1
|
* forgejo: remove "e.g." from placeholder textDaniel Eklöf2025-01-27-1/+1
|
* forgejo: add optional field for terminal multiplexersDaniel Eklöf2025-01-27-3/+9
|
* doc: foot.ini: describe key binding match logicDaniel Eklöf2025-01-27-2/+31
|
* key-bindings: try all bindings in translated mode before matching untranslated, and then finally rawDaniel Eklöf2025-01-27-9/+52
| | | | | | | | | | | | | | | | | | | When trying to match key bindings, we do three types of matching: * Match the _translated_ symbol (e.g. Control+C) * Match the _untranslated_ symbol (e.g. Control+Shift+c) * Match raw keyboard codes This was done for *each* key binding. This meant we sometimes matched a keybinding in raw mode, even though there was a translated/untranslated binding that would match it too. All depending on the internal order of the key binding list. This patch changes it, so that we first try all bindings in translated mode, then all bindings in untranslated mode, and finally all bindings in raw mode. Closes #1929
* forgejo: application -> application(s)Daniel Eklöf2025-01-27-1/+1
|
* forgejo: add optional field for shell/TUIDaniel Eklöf2025-01-27-0/+6
|
* config: fix memory leak on e.g. "not a valid XKB key name" errorsDaniel Eklöf2025-01-27-5/+4
|
* render: resize: configure with only one dimension being zeroDaniel Eklöf2025-01-26-15/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The protocol states: If the width or height arguments are zero, it means the client should decide its own window dimension. This may happen when the compositor needs to configure the state of the surface but doesn't have any information about any previous or expected dimension. The wording is a bit ambiguous; does it mean we should set *both* width and height to values we choose, even if only one dimension is zero in the configure event? Or does it mean that we should choose the value for the dimension that is zero in the configure event? Regardless, it's pretty clear that it does *not* mean we should *only* choose width and height if *both* dimensions are zero in the configure event. This is foot's behavior before this patch, meaning if only one of them is zero, foot assumed the compositor wanted us to set the width (or height) to zero... Change this, so that we now choose value for the "missing" dimension, but do use the compositor provided value for the other dimension. Closes #1925 Relevant issues: * https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/155 * https://github.com/YaLTeR/niri/issues/1050
* grid: reflow: regression: remove (truncate) SPACER cells at the end of lineDaniel Eklöf2025-01-25-1/+6
| | | | | | | | | | | | | | | | | | | | When printing a double-width glyph at the end of the line, it will get pushed to the next line if there's only one cell left on the current line. That last cell on the current line is filled with a SPACER value. When reflowing the text, the SPACER cell should be "removed", so that the double-width glyph continues directly after the text on the previous line. 9567694bab7149afbb4e4fcc4c754272a8d25aba fixed an issue where reflowing e.g. neofetch output incorrectly removed spaces between the logo, and the system info. But also introduced a regression where SPACER values no longer are removed. This patch tries to fix it, by adding back empty cells, but NOT SPACER cells.
* changelog: cwd > 1024 charsDaniel Eklöf2025-01-24-0/+3
|
* client: port bfabc5450b3a01c7d701809b3cf6158220ea289e to footclientDaniel Eklöf2025-01-24-1/+1
|
* fix infinite loop/oom when cwd longer then 1024camel-cdr2025-01-24-1/+1
| | | | | | The code reads cwd into a buffer, which is expanded while errno is ERANGE, with the intent of growing the buffer until the path fits. While getcwd will set errno on error, it will not reset it once the path fits into the buffer. So to not get an infinite loop once errno is ERANGE, we need to make sure to reset errno, such that the loop behaves as expected.
* config: check for FcNameUnparse() failureDaniel Eklöf2025-01-24-0/+5
|
* input: kitty: refactor, try to simplify and be less confusingDaniel Eklöf2025-01-22-47/+60
| | | | | | | | | | Use better named variables while juggling the shifted vs. unshifted key codes. Switch to variable names appropriate for the kitty keyboard protocol once we have all the unshifted, shifted and base key codes done. It's not until then we can decide which key code to use as the main key, and whether or not to report the alternate key code.
* input: kitty: add more test casesDaniel Eklöf2025-01-22-0/+46
|
* input: kitty: only set 'alternate' if the "unshifted" code is printableDaniel Eklöf2025-01-22-19/+26
| | | | | Fixes a regression where alt+backspace was reported as ^[[8:127;3u instead of ^[[127;3u.
* input: codespell: indiciates -> indicatesDaniel Eklöf2025-01-22-2/+2
|
* shm: codespell: re-using -> reusingDaniel Eklöf2025-01-22-1/+1
|
* input: kitty: add initial unit testDaniel Eklöf2025-01-22-0/+229
| | | | | | | | Test a couple of key combos from the se and de(neo) layouts. This unit test isn't intended to test _all_ key combinations, for all kitty flag combinations, but to be more of a regression test - whenever we discover a buggy, weird combo, add it here.
* input: kitty: improve handling of alternate+base keys even moreDaniel Eklöf2025-01-20-33/+41
| | | | | | | | | | | | | | | | * Always do a base key lookup. Before this, we didn't do that if we matched the XKB sym to a lookup table entry (i.e. keypads, cursor keys etc.) * Try to retrieve the unshifted symbol also when we matched the symbol to a lookup table entry. When successful, we now report an alternate key for keypad and cursor keys; before this patch, we only did that for keys that didn't have an entry in the lookup table (i.e. ASCII chars etc). This improves compatibility with kitty (and the kitty keyboard protocol) in more corner cases. One particular example is the neo keyboard layout, where part of the regular keys act as keypad keys when num-lock is active.
* input: kitty: fix alternate codepoint sometimes not being reportedDaniel Eklöf2025-01-20-23/+9
| | | | | | | | | | | | | | | | | | | | | When alternate key reporting is enabled (i.e. when we're supposed to report the shifted key along with the unshifted key), we try to figure out whether the key really is shifted or not (and thus which xkb keysym to use for the unshifted and shifted keys in the escape). This was done by getting the layout's *all* modifier combinations that produce the shifted keysym, and if any of of them contained a modifier that isn't supported by the kitty protocol, the shifted and unshifted keys are derived from the same keysym. This is to ensure we handle things like AltGr-combos correctly. The issue is, since there may be more than one modifier combination generating the shifted keysym, we may end up using the wrong keysym just because _another_ combination set contains modifiers not supported by the kitty protocol. What we're interrested in is whether the *pressed* set of modifiers contains such modifiers. Closes #1918
* vt: combining chars: ensure 'key' is within rangeDaniel Eklöf2025-01-18-0/+2
| | | | | | When there's a key collision, we increment the key and check again. When doing this, we need to ensure the key is withing range, and wrap around to 0 if the key value is too large.
* Merge branch 'releases/1.20'Daniel Eklöf2025-01-18-7/+20
|\
| * changelog: move utf8proc entry to correct release1.20.2releases/1.20Daniel Eklöf2025-01-18-3/+3
| |
| * changelog: add back entry to 1.20.1, removed in de3becef96f30b96f0fceddf73805c3951ccb59fDaniel Eklöf2025-01-18-0/+3
| |
| * meson: bump version to 1.20.2Daniel Eklöf2025-01-18-1/+1
| |
| * changelog: prepare for 1.20.2Daniel Eklöf2025-01-18-6/+5
| |
| * forgejo: bugs: short explanation of what an IME isDaniel Eklöf2025-01-18-2/+2
| |
| * forgejo: bugs: config: uppercase description's first letterDaniel Eklöf2025-01-18-1/+1
| |
| * forgejo: bugs: add required field 'config'Daniel Eklöf2025-01-18-0/+7
| | | | | | | | Require all bug submitters to include their foot configs.
| * forgejo: bugs: add required field 'distro'Daniel Eklöf2025-01-18-0/+8
| |
| * term: cursor_refresh(): don't try to dirty the grid if we don't have oneDaniel Eklöf2025-01-18-0/+7
| | | | | | | | | | | | | | | | | | | | | | If the compositor sends a keyboard enter event before our window has been mapped, foot crashes; the enter event triggers a cursor refresh (hollow -> non-hollow block cursor), which crashes since we haven't yet allocated a grid. Fix by no-op:ing the refresh if the window hasn't been configured yet. Closes #1910
| * changelog: colors.flash-alpha=1.0Daniel Eklöf2025-01-18-0/+6
| |
| * Revert "config: don't allow colors.flash-alpha to be 1.0"Alexander Orzechowski2025-01-18-26/+2
| | | | | | | | This reverts commit 56d2c3e990509d18de31e6009e0d0c6254f99b67.
| * terminal: Refresh only overlay when flash expiresAlexander Orzechowski2025-01-18-1/+6
| | | | | | | | | | | | | | If we call render_refresh, that will wait for a callback to the main surface. In the case of a flash, the main surface might not get callbacks if the compositor implements fancy culling optimizations like wlroots wlr_scene compositors such as sway version >=1.10.
| * render: Expose render_overlayAlexander Orzechowski2025-01-18-1/+5
| | | | | | | | | | This function updates the overlay that foot uses. It will be used to update the overlay when the flash effect ends.
| * changelog: 'CSI 21 t' and 'OSC 176 ?' disabledDaniel Eklöf2025-01-18-0/+7
| |