aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeLines
...
| * vt: utf8: don’t scan *all* previous chainsDaniel Eklöf2021-06-24-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When checking if we already have a compose chain for the current sequence of characters, don’t search the list from the beginning, unless we have to. Taking the following things into consideration: * New compose chains are always appended at the end of the list * If the current sequence is 3 or more characters, it *must* consist of an existing compose chain, plus the new character. Thus, when searching, start at index 0 if we only have two characters, since then the base cell originally contained a regular base character, and not a compose chain. I.e. the new chain may be _anywhere_ in the chain list. If however we have a sequence of three or more characters, start at the index the *base* chain was at. If the chain we’re searching for exists, it *must* have been added *after* the base chain, and thus it *must* be located *after* the base chain in the chain list.
| * vt: utf8: de-duplicate; jump to end of function to print to gridDaniel Eklöf2021-06-24-26/+25
| |
| * render: don’t modify the cell’s x position. Fixes broken underlinesDaniel Eklöf2021-06-24-6/+7
| |
| * vt: utf8-print: don’t build a compose chain on a zero-width base characterDaniel Eklöf2021-06-24-87/+89
| |
| * term: lower maximum number of characters in a compose chainDaniel Eklöf2021-06-24-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before the grapheme cluster segmentation work, we limited the number of combining characters to base+5. I.e. 6 in total. For a while now, we’ve had it bumped all the way up to 20. This was the reason the unicode-random benchmark ran so much slower (i.e. cache contention). Looking at emoji’s, there are a couple that need 6 code points, and *three* that needs 7. Now, with the limit at 7 chars, and the new ‘width’ member, the composed struct is 8 bytes larger than before.
| * vt: utf8-print: check base character before count when looking for existing compose chainDaniel Eklöf2021-06-24-2/+2
| | | | | | | | | | Count is more likely to be the same for many chains. Thus we’re likely to fail sooner by checking the base character first.
| * render: we’ve already assigned ‘base’ a couple of lines higher upDaniel Eklöf2021-06-24-2/+1
| |
| * vt: don’t call wcwidth() on all combining characters every time we addDaniel Eklöf2021-06-24-11/+7
| | | | | | | | | | | | | | We already have all the widths needed to calculate the new one; it’s the base characters width (base_width), or the previous combining chain’s width (composed->width) plus the new characters’s width (width).
| * vt: presentation selectors may be anywhere in the clusterDaniel Eklöf2021-06-24-8/+10
| |
| * render: repair parenthesis after rebaseDaniel Eklöf2021-06-24-5/+5
| |
| * render: ensure ‘cell_cols’ have been initializedDaniel Eklöf2021-06-24-1/+1
| |
| * render: handle fcft_glyph_rasterize() failure correctlyDaniel Eklöf2021-06-24-3/+8
| |
| * render: use column count from grapheme instead of first glyph, when we have oneDaniel Eklöf2021-06-24-2/+8
| |
| * vt: don’t force cols=2 when we see an emoji variant selectorDaniel Eklöf2021-06-24-1/+3
| | | | | | | | | | Fish appears to be the only shell expecting this. The rest probably just does wcswidth(), like usual.
| * vt: cache grapheme cluster width in composed structDaniel Eklöf2021-06-24-12/+11
| | | | | | | | | | | | * Use regular wcswidth() to calculate the width * Explicitly set to ‘2’ if we see a emoji variant selector * Cache the result in the composed struct
| * wip: grapheme shapingDaniel Eklöf2021-06-24-175/+337
|/
* Merge branch 'sixel-heap-user-after-free-after-blending'Daniel Eklöf2021-06-24-12/+10
|\
| * sixel: fix crash when splitting up an image across the scrollbackDaniel Eklöf2021-06-24-12/+10
|/ | | | | | | | | | | | | | | If an image was split up across the scrollback, and the first image chunk was resized due to it being blended with an already existing sixel, we crashed. The reason being the second chunk, emitted *after* the scrollback, tried to memcpy() image data from a now-free:d image buffer. The fix is pretty simple: create copies for *all* chunks when an image has to be split up across the scrollback. Previously, the first chunk re-used the source image buffer. Closes #608
* Merge branch 'custom-terminfo-install-location'Daniel Eklöf2021-06-24-7/+45
|\ | | | | | | Closes #569
| * changelog: -Dterminfo-install-location meson command line optionDaniel Eklöf2021-06-23-0/+2
| |
| * install: add the new ‘terminfo-install-location’ optionDaniel Eklöf2021-06-23-4/+28
| | | | | | | | | | | | | | And flesh out the description of the ‘terminfo’ option, and how it relates to the new ‘terminfo-install-location’. Also add instructions on how to manually generate the terminfo files.
| * meson: add -Dterminfo-install-location=disabled|custom-pathDaniel Eklöf2021-06-23-3/+15
|/ | | | | | | | | | | | | | | | Add a new meson option, ‘terminfo-install-location’, that allows you to customize _where_ the terminfo files are installed, relative to the installation prefix. It also recognizes the special value ‘disabled’, in which case the terminfo files are not installed at all. The terminfo files _are_ however built (allowing us to catch build errors), and foot still defaults to the ‘foot’ terminfo. It defaults to $datadir/terminfo If (the other option) ‘terminfo’ is set to disabled (or tic cannot be found), terminfo-install-location is automatically set to ‘disabled’.
* server: make sure ‘overrides’ have been initialized in all error pathsDaniel Eklöf2021-06-23-1/+1
|
* client: make sure ‘fd’ is initialized in all error pathsDaniel Eklöf2021-06-23-1/+2
|
* Merge branch 'footclient-override'Daniel Eklöf2021-06-23-131/+155
|\ | | | | | | Closes #600
| * client: add and use function push_override()Daniel Eklöf2021-06-23-48/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now track override data (length + malloc:ed string) in a struct, and push this struct to our overrides linked list. There’s a new function, push_override() that takes a string, calculates its length, strdup() it and pushes it to the linked list. This function also length-checks the string, to ensure we don’t overflow. This way, we don’t have to loop the overrides list twice; once when calculating the total length of all overrides, and once when sending the overrides to the server. Now, we can update the total length as we add overrides (i.e while parsing the command line, instead of afterwards). This means we only have to loop the list once, and that’s when sending it. This also means there’s no longer any need to malloc an array holding the lengths of each override.
| * changelog: add ref to #600 (-o,--override for footclient)Daniel Eklöf2021-06-23-1/+2
| |
| * completions: add -o,--override to footclientDaniel Eklöf2021-06-23-1/+4
| |
| * doc: footclient.1: document -o,--overrideDaniel Eklöf2021-06-23-0/+4
| |
| * doc: foot.1: remove trailing space, add ‘=’ between option name and its valueDaniel Eklöf2021-06-23-2/+2
| |
| * client: implement -o,--overrideDaniel Eklöf2021-06-23-1/+7
| |
| * main: usage: add ‘=’ between --override and its valueDaniel Eklöf2021-06-23-1/+1
| | | | | | | | This is how all other long options are documented in the usage.
| * server: avoid “member access within misaligned address” ASAN warningDaniel Eklöf2021-06-23-7/+6
| |
| * client: send overrides for everything that is publicly visible in the confDaniel Eklöf2021-06-23-141/+109
| | | | | | | | | | | | | | | | | | Send a generic “overrides” list to the server, containing options in text, on the format “section.key=value”. This reduces the size of the base client/server protocol packet, as well as opens up for a generic -o,--override command line option (not yet implemented).
| * server: use config_clone() + config_override_apply()Daniel Eklöf2021-06-23-22/+50
|/ | | | | | | | | When the connecting client overrides config options, clone the server’s configuration, and then convert the overridden options to config overrides, and apply them using config_override_apply(). When destroying the client, free the cloned config using the regular config_free().
* Merge branch 'refresh-on-csd-ssd-change'Daniel Eklöf2021-06-23-52/+43
|\
| * wayland: apply CSD/SSD changes in the surface configure eventDaniel Eklöf2021-06-23-52/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The configure event asks the client to change its decoration mode. The configured state should not be applied immediately. Clients must send an ack_configure in response to this event. See xdg_surface.configure and xdg_surface.ack_configure for details. In particular, ”the configured state should *not* be applied immediately”. Instead, treat CSD/SSD changes like all other window dimension related changes: store the to-be mode in win->configure, and apply it in the surface configure event. This fixes an issue where foot incorrectly resized the window when the server switched between CSD/SSD at run-time.
* | config: clone: fix font-list cloningDaniel Eklöf2021-06-23-1/+4
| | | | | | | | Need to copy over *all* members...
* | Merge branch 'config-clone'Daniel Eklöf2021-06-23-120/+246
|\ \ | |/ |/|
| * config: add new function config_clone()Daniel Eklöf2021-06-23-106/+214
| |
| * tokenize: strdup() each individual argvDaniel Eklöf2021-06-20-38/+56
|/ | | | | Instead of referencing the un-tokenized “raw” command string, strdup() each argv. This way, the input string can be ‘const’.
* config: remove duplicated error logs for invalid colorsDaniel Eklöf2021-06-20-18/+6
|
* Merge branch 'csd-button-fg-color'Daniel Eklöf2021-06-20-10/+43
|\
| * config: add csd.button-color optionDaniel Eklöf2021-06-20-10/+43
|/ | | | | | | | This option controls the foreground color of the minimize/maximize/close buttons. I.e. the color used to draw the minimize/maximize/close glyphs. It defaults to default background color.
* uri: hostname_is_localhost(): don’t crash if hostname == NULLDaniel Eklöf2021-06-19-3/+5
|
* term: fix regression after merging #599Daniel Eklöf2021-06-18-3/+3
| | | | | Don’t increment ‘j’ twice in each loop iteration, and fix typo in loop condition (check ‘j’, not ‘i’).
* Merge branch 'title-update'Daniel Eklöf2021-06-18-24/+78
|\ | | | | | | Closes #591
| * render: don’t create/destroy the title update timer each timeDaniel Eklöf2021-06-18-37/+45
| | | | | | | | | | Create it once when instantiating the terminal. Add a boolean to track whether the timer is running or not.
| * render: use a timer instead of relying on the frame callback for title update throttlingDaniel Eklöf2021-06-18-18/+64
|/ | | | | | | | | | | | | | | | | | | | | Using the frame callback works most of the time, but e.g. Sway doesn’t call it while the window is hidden, and thus prevents us from updating the title in e.g. stacked views. This patch uses a timer FD instead. We store a timestamp from when the title was last updated. When the application wants to update the title, we first check if we already have a timer running, and if so, does nothing. If no timer is running, check the timestamp. If enough time has passed, update the title immediately. If not, instantiate a timer and wait for it to trigger. Set the minimum time between two updates to ~8ms (twice per frame, for a 60Hz output, and ~once per frame on a 120Hz output). Closes #591
* Merge branch 'reduce-tllist-usage'Daniel Eklöf2021-06-18-276/+380
|\
| * config: work around clang-11.0 issueDaniel Eklöf2021-06-18-62/+62
| | | | | | | | | | | | Clang-11.0 doesn’t seem to understand that our ‘static const’ key modifiers are compile-time constant. Clang-11.1 doesn’t appear to have this issue.
| * config: don’t use tllist where it isn’t necessaryDaniel Eklöf2021-06-18-276/+380
|/ | | | | | | | | | | | | | | | tllists are great when dealing with dynamically changing lists. They are also very easy to use when building lists/arrays where the final size is unknown. However, this ease of use comes at a price: code size. tll-macros expand to a lot of code. Since things in the config are static, once the config has been loaded, using tllists for configuration data structures doesn’t make much sense. This patch replaces nearly all tllists used by the configuration, with dynamically allocated arrays.
* Merge branch 'footclient-dont-copy-conf-unless-necessary'Daniel Eklöf2021-06-18-28/+50
|\
| * server: don’t clone the config unless we’re going to modify itDaniel Eklöf2021-06-17-28/+50
| |
* | Merge branch 'underline-positioning'Daniel Eklöf2021-06-18-9/+42
|\ \ | |/ |/| | | Closes #490
| * config: add underline-offset optionDaniel Eklöf2021-06-17-9/+42
|/ | | | | | | | This option allows the user to configure a custom underline offset. That is, use the user provided offset instead of the font provided one. Closes #490
* search: don’t crash when we don’t have any XKB compose stateDaniel Eklöf2021-06-16-2/+5
|
* Merge branch 'optimize-erase-cell-range'Daniel Eklöf2021-06-15-0/+6
|\
| * term: erase_cell_range: early break out from URI loopDaniel Eklöf2021-06-15-0/+6
|/ | | | | | | URI ranges are sorted. This means we don’t have to check any more ranges once we’ve seen one that starts *after* the erase range. Closes #594
* term: no need to set attrs.clean=0 right after copying the VT attrs structDaniel Eklöf2021-06-15-3/+0
| | | | | | | | | When printing a character to a cell, we copy the current VT state’s attributes to the cell. And then clear the ‘clean’ bit. But the ‘clean’ bit is part of the VT state, and is *always* zero. Thus there’s no need to explicitly clear it right after copying the VT state.
* Revert "gitignore: compile_commands.json + .ccls-cache"Daniel Eklöf2021-06-15-2/+0
| | | | This reverts commit 1dabc10494ac6626398c99507b791a21b923a616.
* Merge branch 'doc-cc1-to-c1'Daniel Eklöf2021-06-14-1/+1
|\
| * [foot-ctlseqs] 8-bit control characters are C1nick black2021-06-14-1/+1
|/
* gitignore: compile_commands.json + .ccls-cacheDaniel Eklöf2021-06-13-0/+2
|
* Merge branch 'xtversion'Daniel Eklöf2021-06-13-4/+30
|\ | | | | | | Closes #359
| * doc: ctlseq: add XTVERSIONDaniel Eklöf2021-06-13-0/+5
| |
| * csi: implement XTVERSION (CSI > 0q)Daniel Eklöf2021-06-13-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | This is a fairly new XTerm extension. The reply is on the format: DCS > | text ST XTerm replies with ‘text’ = “XTerm(366)”. Foot replies with ‘text’ = “foot(1.6.4)” Closes #359
| * generate-version: add a define for “extra” version informationDaniel Eklöf2021-06-13-4/+6
| | | | | | | | | | This will be set to “rrr-gNNNNNNN” when building from git, and the empty string otherwise.
* | doc: foot-ctlseqs: mention that SS2/SS3 only affect the next characterCraig Barnes2021-06-12-2/+2
| |
* | doc: foot-ctlseqs: rename SS0/SS1 to SO/SICraig Barnes2021-06-12-2/+2
|/ | | | | | | | | | | There's no mention of SS0 or SS1 functions in ECMA-48 or ECMA-35. 0x0E/0x0F are SO/SI (Shift In/Out) in "7-bit environments" or LS0/LS1 (Locking Shift 0/1) in "8-bit environments". The former is the one that applies to foot, since it generally follows "7-bit" conventions due to its use of UTF-8. See also: ECMA-35 §7.2 and §9.2.
* Replace tab indents with spaces in config.hCraig Barnes2021-06-12-2/+2
|
* Merge branch 'config-cli-override'Daniel Eklöf2021-06-12-87/+182
|\ | | | | | | Closes #554
| * Override options from command lineRyan Farley2021-06-12-87/+182
|/ | | | | | | | | Allow any configuration option to be overridden with -o/--override 'section.key=value' arguments, as suggested in #554 update completitions for override slight refactoring to ease footclient support
* Merge branch 'no-conf-found-is-not-an-error'Daniel Eklöf2021-06-11-1/+4
|\
| * config: demote “no configuration found, using defaults” to a mere warningDaniel Eklöf2021-06-10-1/+4
| | | | | | | | | | And don’t notify the user in the terminal window, only log it on stderr.
| * config: change “no configuration found, using defaults” from error to warningDaniel Eklöf2021-06-10-1/+1
|/
* Merge branch 'free-box-drawings-data'Daniel Eklöf2021-06-09-13/+19
|\ | | | | | | Closes #586
| * term: free the data associated with the pixman image when destroying box-drawing glyphsDaniel Eklöf2021-06-09-13/+19
|/ | | | Closes #586
* Merge branch 'clipboard-mime-types'Daniel Eklöf2021-06-09-6/+21
|\ | | | | | | Closes #583
| * selection: add support for TEXT/STRING/UTF8_STRING mime-types in incoming offersDaniel Eklöf2021-06-09-6/+21
|/ | | | | | | | | We were already offering these mime types for our own clipboard data, but ignored them in incoming offers. Fixes paste issues from Geany. Closes #583
* Merge branch 'charset-shift-fixes'Craig Barnes2021-06-09-14/+47
|\
| * terminal: add 'charset_designator' enum to make code more self-documentingCraig Barnes2021-06-09-18/+19
| | | | | | | | | | | | This commit also renames the term_set_single_shift_ascii_printer() function to term_single_shift(), since the former is overly verbose and not really even accurate.
| * changelog: add issue links for previous 2 entriesCraig Barnes2021-06-09-2/+3
| |
| * vt: fix SS2/SS3 escape sequences to act correctly as single shiftsCraig Barnes2021-06-08-4/+22
| | | | | | | | | | | | These sequences are supposed to affect the next printable ASCII character and then reset to the previous character set, but before this commit they were behaving like locking shifts.
| * vt: add support for LS2 and LS3 locking shiftsCraig Barnes2021-06-08-0/+13
| |
* | Merge branch 'overlapping-sixels'Daniel Eklöf2021-06-09-17/+225
|\ \ | | | | | | | | | Closes #562
| * | sixel: add support for overlapping sixelsDaniel Eklöf2021-06-09-17/+225
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Writing a sixel on top of an already existing sixel currently has the following limitations in foot: * The parts of the first sixel that is covered by the new sixel are removed, completely. Even if the new sixel has transparent areas. I.e. writing a transparent sixel on top of another sixel *replaces* the first sixel with the new sixel, instead of layering them on top of each other. * The second sixel erases the first sixel cell-wise. That is, a sixel whose size isn’t a multiple of the cell dimensions will leave unsightly holes in the first sixel. This patch takes care of both issues. The first one is actually the easiest one: all we need to do is calculate the intersection, and blend the two images. To keep things relatively simple, we use the pixman image from the *new* image, and use the ‘OVER_REVERSE’ operation to blend the new image over the old one. That is, the old image is still split into four tiles (top, left, right, bottom), just like before. But instead of throwing away the fifth middle tile, we blend it with the new image. As an optimization, this is only done if the new image has transparency (P1=1). The second problem is solved by detecting when we’re erasing an area from the second image that is larger than the new image. In this case, we enlarge the new image, and copy the old image into the new one. Finally, when we enlarge the new image, there may be areas in the new image that is *not* covered by the old image. These areas are made transparent. The end result is: * Each cell is covered by at *most* 1 sixel image. I.e. the total numbers of sixels are finite. This is important for the ‘mpv --vo=sixel’ use case - we don’t want to end up with thousands of sixels layered on top of each other. * Writing an opaque sixel on top of another sixel has _almost_ zero performance impact. Especially if the two sixels have the same size, so that we don’t have to resize the new image. Again, important for the ‘mpv --vo=sixel’ use case. Closes #562
* | Merge branch 'tabs'Daniel Eklöf2021-06-09-4/+70
|\ \ | |/ |/| | | Closes #508
| * changelog: tabs are preservedDaniel Eklöf2021-06-09-0/+2
| |
| * csi: CHT: don’t alter the LCF flagDaniel Eklöf2021-06-08-0/+3
| | | | | | | | | | This makes us pass the vttest 11.5.4 (Test non-VT100 -> Test ISO-6429 cursor-movement -> CHT) test.
| * vt: TAB: don’t print a ‘\t’ to the grid if the *current* cell isn’t emptyDaniel Eklöf2021-06-08-3/+4
| | | | | | | | | | | | | | | | If the cursor is already at the right edge, our logic that checked for non-empty cells failed; it didn’t check the current cell. Fix by initializing ‘emit_tab_char’ to true/false, depending on the contents of the current cell.
| * extract: consume spaces following a tabDaniel Eklöf2021-06-08-0/+23
| | | | | | | | | | | | That is, we choose to copy the tab character, and not the spaces it represents. Most importantly, we don’t copy *both* the tab and the spaces.
| * vt: emit a tab character if all cells between cursor and tab stop are emptyDaniel Eklöf2021-06-08-4/+41
|/ | | | | | | | | | | | | | | | | | | | | | TAB (\t) move the cursor to the next tab stop. That’s it, according to the specification. However, many terminal emulators try to keep tabs in the grid, to be able to e.g. copy them. That is, copying a text chunk containing tabs should result in tabs being pasted, not spaces. In order to do that, we need to print a tab character to the grid. To improve text reflow of tabs, we also print spaces to the subsequent cells, up until (but not including) the next tab stop. However, we can only do this if all the cells between the cursor and the next tab stop are empty, since (obviously), we cannot overwrite pre-existing characters. Finally, while some fonts render tabs as spaces (i.e. an empty glyph), some use a glyph representing “unprintable” characters, or similar. Thus, we need to exclude cells with tab characters when rendering.
* Merge branch 'il-dl-reset-cursor-col'Daniel Eklöf2021-06-08-0/+3
|\
| * csi: IL+DL: move cursor to column 0Daniel Eklöf2021-06-08-0/+3
|/ | | | | | | | | This fixes vttest 11.6.6.3 Test non-VT100 -> Test ISO-6429 colors -> Test of VT102-style features with BCE -> Test Insert/Delete Char/Line
* Merge branch 'reverse-video-only-affects-default-fg-bg'Daniel Eklöf2021-06-08-4/+7
|\
| * render: reverse video only swaps *default* fg/bgDaniel Eklöf2021-06-08-4/+7
| | | | | | | | | | | | | | | | | | This matches XTerm behavior, and fixes vttest 11.6.6.2: Test non-VT100 -> Test ISO-6429 colors -> Test of VT102-style features with BCE -> Test of screen features
* | vt: fix buggy chains of ternary expressions in action_esc_dispatch()Craig Barnes2021-06-08-18/+9
| | | | | | | | | | | | | | | | | | | | Only the first character in the chain was being compared with `priv` and the rest were just being evaluated as simple expressions. This was causing the G2 and G3 operations to erroneously use the G1 index. Since the characters are a contiguous range, we can just subtract the start of the range to get the appropriate index. The outer switch statement already ensures the values are in range.
* | terminal: fix compilation error when debug logging is enabledCraig Barnes2021-06-08-2/+2
|/ | | | | | | | | | Without this fix, setting LOG_ENABLE_DBG to 1 in terminal.c would cause the following error: > terminal.c:1787: 'struct terminal' has no member named 'font_scale' The 'font_scale' member was removed in commit 2afc6782361d0deaa443234466775b1121feec8f.
* vt: \E#8: print ‘E’ using the default attributesDaniel Eklöf2021-06-07-1/+1
|