aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeLines
* sixel: re-scale images when the cell dimensions changeDaniel Eklöf2023-06-30-112/+295
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this patch, when the cell dimensions changed (i.e. when the font size changes), sixel images were either removed (the new cell dimensions are smaller than the old), or simply kept at their original size (new cell dimensions are larger). With this patch, sixels are instead resized. This means a sixel *always* occupies the same number of rows and columns, regardless of how much the font size is changed. This is done by maintaining two sets of image data and pixman images, as well as their dimensions. These two sets are the new ‘original’ and ‘scaled’ members of the sixel struct. The "top-level" pixman image pointer, and the ‘width’ and ‘height’ members either point to the "original", or the "scaled" version. They are invalidated as soon as the cell dimensions change. They, and the ‘scaled’ image is updated on-demand (when we need to render a sixel). Note that the ‘scaled’ image is always NULL when the current cell dimensions matches the ones used when emitting the sixel (to save run-time memory). Closes #1383
* meson: log availability of optional wayland protocolsDaniel Eklöf2023-06-30-0/+8
|
* wayland: typo: ‘.’ -> ‘;’Daniel Eklöf2023-06-30-1/+1
| | | | Closes #1392
* Merge branch 'sixel-performance'Daniel Eklöf2023-06-29-48/+146
|\ | | | | | | Closes #1385
| * sixel: add_ar_11(): manually unroll loopDaniel Eklöf2023-06-29-7/+18
| | | | | | | | This generates both smaller, and faster code
| * scripts: generate-alt-random: set P2=1 when emitting sixelsDaniel Eklöf2023-06-29-2/+2
| | | | | | | | | | P2=1 means "empty sixels remain at their current color". This is usually the case with modern sixel encoders.
| * sixel: refactor: shorten very verbose switch case statementsDaniel Eklöf2023-06-29-53/+14
| |
| * sixel: special case parsing of images with an aspect ratio of 1:1Daniel Eklöf2023-06-29-26/+152
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | Images with an aspect ratio of 1:1 are by far the most common (though not the default). It makes a lot of sense, performance wise, to special case them. Specifically, the sixel_add() function benefits greatly from this, as it is the inner most, most heavily executed function when parsing a sixel image. sixel_add_many() also benefits, since allows us to drop a multiplication. Since sixel_add_many() always called first (no other call sites call sixel_add() directly), this has a noticeable effect on performance. Another thing that helps (though not as much), and not specifically with AR 1:1 images, is special casing DECGRI a bit. Up until now, it simply updated the current sixel parameter value. The problem is that the default parameter value is 0. But, a value of 0 should be treated as 1. By adding a special ‘repeat_count’ variable to the sixel struct, we can initialize it to ‘1’ when we see DECGRI, and then simply overwrite it as the parameter value gets updated. This allows us to drop an if..else when emitting the sixel.
* Merge branch 'fractional-scaling'Daniel Eklöf2023-06-29-315/+508
|\
| * wayland: surface_scale(): reset buffer scale when using fractional scalingDaniel Eklöf2023-06-29-0/+1
| | | | | | | | | | Since the first frame uses legacy scaling, the surface may have a buffer scale > 1, which isn’t allowed.
| * wayland: surface_scale(): improve debug loggingDaniel Eklöf2023-06-29-2/+5
| |
| * wayland: use legacy scaling until fractional_scale::preferred_scale() has been calledDaniel Eklöf2023-06-29-1/+3
| | | | | | | | | | | | | | | | | | | | This way, the initial frame is more likely to get scaled correctly; foot will guess the initial (integer) scale from the available monitors, and use that. By using legacy scaling, we force the compositor to down-scale the image to the correct scale factor. If we use the new fraction scaling method with an integer scaling factor, the initial frame gets rendered way too big.
| * wayland: refactor: surface_scale(): pass wl_window pointer, instead of wayland globalDaniel Eklöf2023-06-29-13/+13
| |
| * wayland: surface_scale(): assert surface width/height is a multiple of scaleDaniel Eklöf2023-06-29-0/+7
| | | | | | | | | | When doing legacy scaling (non-fractional scaling), assert the surface’s width and height are multiples of the (integer) scale.
| * wayland: warn when fractional scaling isn’t availableDaniel Eklöf2023-06-29-0/+8
| |
| * feature: add a feature flag (for --version) for fractional scalingDaniel Eklöf2023-06-29-2/+15
| |
| * changelog: dpi-aware’s default value is now ‘no’Daniel Eklöf2023-06-29-0/+6
| |
| * config: dpi-aware: remove ‘auto’ value, and default to ‘no’Daniel Eklöf2023-06-29-88/+48
| | | | | | | | | | | | | | | | | | | | We now default to scaling fonts using the scaling factor, not monitor DPI. The ‘auto’ value for dpi-aware has been removed. Documentation (man pages and README) have been updated to reflect the new default.
| * changelog: mention the newly added support for fractional-scaling-v1Daniel Eklöf2023-06-29-0/+3
| |
| * wayland: update terminal when preferred scaling factor changesDaniel Eklöf2023-06-29-0/+2
| | | | | | | | | | | | When the window’s preferred scaling factor is changed (through the fractional-scaling protocol), update the terminal; resize font, resize sub-surfaces etc.
| * wayland: surface_scale(): implement fractional scalingDaniel Eklöf2023-06-29-2/+11
| | | | | | | | This is done by setting the surface’s viewport destination
| * wayland: initialize window scale to -1Daniel Eklöf2023-06-29-0/+1
| |
| * wayland: instantiate+destroy viewport for pointer surfaceDaniel Eklöf2023-06-29-1/+20
| |
| * wayland: refactor: add a buffer argument to wayl_*_scale() functionsDaniel Eklöf2023-06-29-17/+37
| | | | | | | | | | This will be needed later, when using fractional scaling + viewporter to scale.
| * wayland: refactor: wayl_surface_scale(): pass wayl_surface pointerDaniel Eklöf2023-06-29-37/+32
| | | | | | | | | | | | | | | | Instead of passing a raw wl_surface pointer, pass a wayl_surface pointer. This is needed later, when using fractional scaling to scale the surface (since then we need the surface’s viewport object).
| * wayland: refactor: wrap wl_surface pointers in a wayl_surface structDaniel Eklöf2023-06-29-139/+149
| | | | | | | | | | | | | | | | | | And add a viewport object to accompany the surface (to be used when scaling the surface). Also rename the wl_surf_subsurf struct to wayl_sub_surface, and add a wayl_surface object to it, rather than a plain wl_surface pointer (to also get the viewport pointer).
| * wayland: add viewport object to sub-surface structDaniel Eklöf2023-06-29-2/+28
| |
| * wayland: add wayl_surface_scale(), and wayl_win_scale()Daniel Eklöf2023-06-29-46/+52
| | | | | | | | | | | | | | These functions scale a surface+buffer. For now, only using the legacy scaling method (wl_surface_set_buffer_scale()).
| * render: maybe_resize(): convert local variable ‘scale’ to floatDaniel Eklöf2023-06-29-8/+13
| |
| * wayland: add wayl_fractional_scaling()Daniel Eklöf2023-06-29-0/+12
| | | | | | | | Returns true if fractional scaling is available.
| * wayland: csd_reload_font(): ‘scale’ is now a floatDaniel Eklöf2023-06-29-7/+7
| |
| * term: reload_fonts(): ‘scale’ is not a floatDaniel Eklöf2023-06-29-4/+4
| |
| * render: xcursor_update(): convert local ‘scale’ variable to floatDaniel Eklöf2023-06-29-1/+1
| |
| * render: urls(): round scaling factorDaniel Eklöf2023-06-29-1/+1
| |
| * render: search_box(): round scaling factorDaniel Eklöf2023-06-29-1/+1
| |
| * render: render_timer(): round scaling factorDaniel Eklöf2023-06-29-1/+1
| |
| * render: csd_border: round scaled border width, instead of truncatingDaniel Eklöf2023-06-29-4/+3
| |
| * render: draw_unfocused_block(): round scale, instead of truncatingDaniel Eklöf2023-06-29-1/+1
| |
| * wayland: pointer.scale: convert to floatDaniel Eklöf2023-06-29-4/+4
| |
| * term: convert ‘scale’ to a floatDaniel Eklöf2023-06-29-21/+25
| |
| * wayland: plumbing for wp-fractional-scaleDaniel Eklöf2023-06-29-0/+77
| | | | | | | | | | | | | | * Bind the wp-viewporter and wp-fractional-scale-manager globals. * Create a viewport and fractional-scale when instantiating a window. * Add fractional-scale listener (that does nothing at the moment). * Destroy everything on teardown.
| * meson: generate bindings for wp-fractional-scale + wp-viewportDaniel Eklöf2023-06-29-0/+5
|/
* correct csd section entry: hide-when-maximizedVladimir Bauer2023-06-27-1/+1
|
* config: unittest: explicitly call fcft_init() + fcft_fini()Daniel Eklöf2023-06-26-0/+4
| | | | | This plugs a memory leak, caused by fontconfig functions being called as part of the unit test implicitly allocating global objects.
* sixel: assert upper pixel of last sixel maps to last image row, *or lower*Daniel Eklöf2023-06-24-0/+2
|
* sixel: ensure enough rows have been scrolled in, to fit the imageDaniel Eklöf2023-06-24-4/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When emitting a sixel, we need to: a) scroll terminal content to ensure the new image fits b) position the text cursor Recent changes in the cursor positioning logic meant we reduced the number of linefeeds, to ensure 1) sixels could be printed to the bottom row without scrolling the terminal contents, and 2) the cursor was positioned on the last sixel row. Except, we’re not actually positioning the cursor on the last sixel row. We’re positioning it on the text row that maps to the *upper* pixel of the last sixel. In most cases, this _is_ the last row of the sixel. But for certain combinations of font and image sizes, it may be higher up. This patch fixes a regression, where the terminal contents weren’t scrolled up enough for certain images, causing a crash when trying to dirty a not-yet scrolled in row. The fix is this: * Always scroll by the number of rows occupied by the image, minus one. This ensures the image "fits". * Adjust the cursor position, if necessary.
* sixel: resize(): handle no size changeDaniel Eklöf2023-06-24-0/+3
|
* sixel: regression: linefeed count for chunked up sixel imageDaniel Eklöf2023-06-24-1/+6
| | | | All image chunks but the last *should* scroll the screen content.
* sixel: minor fixes after implementing support for non-1:1 aspect ratiosDaniel Eklöf2023-06-24-17/+29
| | | | | | | * Lazy initialize image height. This is necessary to prevent garbage from being rendered for "empty" sixels. * Fix plotting of non-1:1 pixels * Fix calculation of height in resize(), for non-1:1 aspect ratios
* sixel: stop cropping images to the last non-transparent rowDaniel Eklöf2023-06-24-22/+1
|
* sixel: respect sixel aspect ratioDaniel Eklöf2023-06-24-14/+52
| | | | | | | | That is, parse P1 when initializing a new sixel, and don’t ignore pad/pad in the raster attributes command. The default aspect ratio is 2:1, but most sixels will override it in the raster attributes command (to 1:1).
* sixel: fix cursor positioning logicDaniel Eklöf2023-06-24-20/+26
| | | | | | | | | | | | | | | | | | This adjusts the logic that positions the text cursor after emitting a sixel, when sixel scrolling mode is *enabled*. We’ve always mimicked XTerm’s behavior. However, XTerm recently changed its behavior, to better match that of an VT382. Now, the cursor is placed *on* the last row of the sixel, instead of on a new row after the sixel. This allows applications to print sixels to the bottom row of the terminal, without causing the content to scroll. Finally, there was a bug in the horizontal positioning of the cursor; it was placed on the *first* column of the row, instead of on the first column of the sixel.
* term: scroll: only record scroll damage when viewport is at the bottomDaniel Eklöf2023-06-23-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don’t need to record scroll damage if the viewport isn’t at the bottom, since in this case, the renderer ignores the scroll damage anyway. This fixes a performance corner case, when the viewport is at the top of the scrollback history. When application scrolls the terminal contents, and the scrollback history is full, and the viewport is at top of the history, then the viewport needs to be moved (the scrollback history is a circular buffer, and thus the top of the history “moves” when we’re scrolling in new contents). Moving the viewport typically results in another type of scroll damage (DAMAGE_SCROLL_IN_VIEW, instead of the “normal” DAMAGE_SCROLL). Thus, each application triggered scroll, will result in two scroll damage records: one DAMAGE_SCROLL, and one DAMAGE_SCROLL_IN_VIEW. These two are incompatible, meaning they can’t be merged. What’s worse, it also means the DAMAGE_SCROLL records from two application triggered scrolls cannot be merged (since there’s a DAMAGE_SCROLL_IN_VIEW in between). As a result, the renderer will not see one, or “a few” scroll damage events, but a *ton*. _Each_ one typically a single line, or so. And each one resulting in lots of traffic on the wayland socket, as we create and destroy new buffer pools, when doing “shm scrolling”. This eventually leads to the socket not being able to keep up, and the socket is closed on us, forcing us to exit. The fix is really simple: don’t record “normal” scroll damage when scrolling, _unless_ the viewport is at the bottom (and thus “follows” the application output). As soon as the user scrolls up in the history, we’ll stop emitting normal scroll damage records. This is just fine, since, as mentioned above, the renderer ignores them when the viewport isn’t at the bottom. What if the viewport is moved back down again, before the next frame has been rendered? Wont there be “missing” scroll damage records? No, because moving the viewport results in scroll damage records by itself. Closes #1380
* Fixed a type for the pixel fontsize changewout2023-06-23-1/+1
| | | | xp -> px
* render: resize: fix crash when reflowing the alt screenDaniel Eklöf2023-06-20-3/+10
| | | | | | | | | | | | | | | | When doing an interactive resize, and `resize-delay-ms` > 0 (the default), we would crash if the original screen size (i.e. the size before the interactive resize started) was larger than the last window size. For example, if we interactively go from 85 rows to 75, and then non-interactively went from 75 to 80, we’d crash. The resizes had to be made in a single go. One way to trigger this was to start an interactive resize on a floating window, and then *while resizing* toggle the window’s floating mode. Closes #1377
* add srcery themeAntoine Beaupré2023-06-20-0/+26
| | | | Based on https://srcery.sh/
* csi: CHA+HPA (cursor horizontal absolute): use term_cursor_col()Daniel Eklöf2023-06-20-1/+1
|
* term: add term_cursor_col()Daniel Eklöf2023-06-20-0/+10
| | | | | | | Set cursor column, absolute. term_cursor_to() needs to reload the current row pointer, and is thus not very effective when we only need to modify the column.
* vt: split up action_param() to three separate functionsDaniel Eklöf2023-06-16-68/+75
| | | | | | | | | | | | | | | | | | | | | | | | We’re already switching on the next VT input byte in the state machine; no need to if...else if in action_param() too. That is, split up action_param() into three: * action_param_new() * action_param_new_subparam() * action_param() This makes the code cleaner, and hopefully slightly faster. Next, to improve performance further, only check for (sub)parameter overflow in action_param_new() and action_param_subparam(). Add pointers to the VT struct that points to the currently active parameter and sub-parameter. When the number of parameters (or sub-parameters) overflow, warn, and then point the parameter pointer to a "dummy" value in the VT struct. This way, we don’t have to check anything in action_param().
* test: config: add test for url.protocols optionDan Bungert2023-06-15-1/+45
|
* terminfo: add TS capabilityDaniel Eklöf2023-06-15-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a new ‘extended’ capability. ‘TS’ has been around for a while, but was originally not part of foot’s terminfo. Not sure when it was added to ncurses’ foot terminfo. In any case, ncurses has this to say about TS: These building-blocks allow access to the X titlebar and icon name as a status line. There are a few problems in using them in entries: a) tsl should have a parameter to denote the column on which to transfer to the status line. ... But that issue regarding the parameter for tsl means that applications may not rely on it. The SVr4 documentation says tsl will "move to status line, column #1". At the point in time when ESR added DJM's "pseudo-color" entry with the split-up escape sequence for tsl/fsl, there were 65 entries using tsl: 32 used a parameter, matching the documentation (including x10term). 21 used a parameterless control, exiting from the status line on ^M. 6 used parameterless controls for tsl and fsl 6 used a split-up escape sequence, e.g., the same approach. The extension "TS" is preferable, because it does not accept a parameter. However, if you are using a non-extended terminfo, "TS" is not visible.
* terminfo: XM: add private mode 1004Daniel Eklöf2023-06-15-1/+1
| | | | | This was added to ncurses (to the xterm+sm+1006 fragment) in 2023-05-08.
* meson: use meson feed feature for scdoc inputsewn2023-06-14-4/+5
| | | | Removes the need for a shell dependency.
* Fix non UTF-8 locale complaintPhillip Susi2023-06-01-4/+6
| | | | | | | | | If the locale isn't UTF-8, foot tries to fall back to C.UTF-8 and prints a warning. The warning was garbled because the name of the original locale is no longer valid after calling setlocale() a second time. Use strdup to stash the original string. Closes #1362
* sixel: apply background alpha when P2=0 or P2=2, and current bg color is the default bg colorDaniel Eklöf2023-05-31-4/+24
| | | | Closes #1360
* ci: try alpine edge instead of latestDaniel Eklöf2023-05-26-5/+5
|
* osc: update font subpixel mode, and window opaque compositor hint, on alpha changesDaniel Eklöf2023-05-26-12/+32
| | | | | | | | | | | | | | | | | | | | | When background alpha is changed at runtime (using OSC-11), we (may) have to update the opaque hint we send to the compositor. We must also update the subpixel mode used when rendering font glyphs. Why? When the window is fully opaque, we use wl_surface_set_opaque_region() on the entire surface, to hint to the compositor that it doesn’t have to blend the window content with whatever is behind the window. Obviously, if alpha is changed from opaque, to transparent (or semi-transparent), that hint must be removed. Sub-pixel mode is harder to explain, but in short, we can’t do subpixel hinting with a (semi-)transparent background. Thus, similar to the opaque hint, subpixel antialiasing must be enabled/disabled when background alpha is changed.
* .desktop: remove StartupWMClass from server, use distinct StartupWMClass for foot and footclientjdevdevdev2023-05-22-13/+19
| | | | | | | | | | | | | | | For this to work, the default app-id of footclient has been changed from ‘foot’ to ‘footclient’. By using distinct StartupWMClasses, the compositor can connect a running foot/footclient instance to the correct .desktop-file. This ensures the correct icon is being used in e.g. docks, and that actions like “open another window” works correctly. Note that the user can override the app-id, either by setting app-id in foot.ini, or with the -a,--app-id command line option. Closes #1355
* test: config: add test for main.utmp-helper optionDaniel Eklöf2023-05-22-0/+1
|
* utmp: rewrite utmp loggingDaniel Eklöf2023-05-22-58/+159
| | | | | | | | | | | | | | | | | | | | | | | This patch generalizes the utmp support, to not only support libutempter, but also ulog (and in the future, even more interfaces). * Rename config option main.utempter to main.utmp-helper * Add meson option -Dutmp-backend=none|libutempter|ulog|auto * Rename meson option -Ddefault-utempter-path to -Dutmp-default-helper-path * utmp is no longer detected at compile time, but at runtime instead. Meson will configure the following pre-processor macros, based on the selected utmp backend: * UTMP_ADD - argument to pass to utmp helper when adding a record (starting foot) * UTMP_DEL - argument to pass to utmp helper when removing a record (exiting foot) * UTMP_DEL_HAVE_ARGUMENT - if defined, UTMP_DEL expects an extra argument ($WAYLAND_DISPLAY) * UTMP_DEFAULT_HELPER_PATH - path to the default utmp helper binary The documentation has been updated to mention which arguments are passed to the helper binary. Closes #1314
* slave: unset TERM_PROGRAM{,_VERSION}Daniel Eklöf2023-05-18-27/+4
| | | | | | | | | | | | | | | | | | | | | Foot’s policy is to not set environment variables that identifies it (except the well-known and established `TERM` variable). We encourage applications to use terminfo to determine capabilities, or terminal queries, when available. Or, at least use terminal queries to detect the terminal and its version. Setting environment variables is a bad idea since they are inherited by all applications started by the terminal (which is the whole point). But, this includes other terminal emulators, making it very possible a terminal emulator gets mis-detected just because it was started from another terminal. Since there are a couple of terminal emulators that _do_ set TERM_PROGRAM and TERM_PROGRAM_VERSION, unset these environment variables to avoid being misdetected. Closes #1349
* customized gnome-like csd buttonslocture2023-05-18-72/+107
|
* search: regression: refresh current view when canceling a scrollback searchDaniel Eklöf2023-05-15-0/+1
| | | | | | | | | | | | | | | | | | | | 3b41379be43a21a00a776d0d136c5d1b2fe4007e introduced a regression, where canceling a scrollback search didn’t refresh the viewport correctly; the viewport was changed, but the screen content was not refreshed. This worked before, because the workaround for https://github.com/swaywm/sway/issues/6960 always called term_damage_view() when exiting scrollback search mode. 3b41379be43a21a00a776d0d136c5d1b2fe4007e removed that call since it’s no longer required. *Except* when executing the BIND_ACTION_SEARCH_CANCEL binding, since then the viewport may be moved. Note that this regression affected *all* compositors, not just Sway. Closes #1354
* quirks: sway does not damage surface beneath sub-surface, when unmappedDaniel Eklöf2023-05-12-11/+43
| | | | | | | | | | | | | | | | | | | | | When unmapping a sub-surface, Sway <= 1.8 does not damage the surface beneath the sub-surface. https://github.com/swaywm/sway/issues/6960 The workaround is to manually damage the main surface. Previously, this was done when exiting scrollback search, and after the ‘flash’ OSC. But other sub-surfaces, that may also be unmapped, did not. This patch adds a quirk handler that does this, and calls it when: * Exiting scrollback search * Ending the ‘flash’ OSC * Exiting unicode input mode * Clearing URL labels * Removing the scrollback position indicator Closes #1335
* term: reset: switch modifyOtherKeys back to level 1Daniel Eklöf2023-05-12-0/+2
|
* kitty: F3 is no longer allowed to emit CSI RDaniel Eklöf2023-04-26-1/+8
| | | | | | | | The original kitty keyboard specification allowed F3 to emit either CSI R, or CSI 13~. Support for CSI R was removed in later revisions of the protocol, since it collides with "Cursor Position Report" sequences.
* csi: implement "CSI ? m"Daniel Eklöf2023-04-26-1/+42
|
* render: regression: keep empty bottom scroll margin empty after resizeDaniel Eklöf2023-04-12-1/+4
|
* render: ensure scroll region’s endpoint is valid after a window resizeDaniel Eklöf2023-04-12-5/+6
| | | | | | | | | If we had a non-empty bottom scroll region, and the window was resized to a smaller size, the scroll region was not reset correctly. This led to a crash when scrolling the screen content. Fix by making sure the scroll region’s endpoint is within range.
* meson: bump tllist dependency version to 1.1.0Vivian Szczepanski2023-04-09-1/+1
| | | | | The tll_sort() macro was added to tllist in version 1.1.0, and so building with a previous version causes a linking error.
* *.desktop: add StartupWMClass=footDaniel Eklöf2023-04-05-0/+9
| | | | | | | | At least Gnome needs this in order to link running instances of foot to their corresponding .desktop file, used e.g. when determining which icon to display for running applications. Closes #1317
* changelog: add a new ‘unreleased’ sectionDaniel Eklöf2023-04-03-0/+11
|
* Merge branch 'releases/1.14'Daniel Eklöf2023-04-03-6/+19
|\
| * meson: bump version to 1.14.01.14.0releases/1.14Daniel Eklöf2023-04-03-1/+1
| |
| * changelog: prepare for 1.14.0Daniel Eklöf2023-04-03-5/+18
|/
* terminfo: remove DECRST of DECCOLM+DECSCLMDaniel Eklöf2023-04-02-2/+3
| | | | | | | | We’ve never supported neither 132-column mode, nor smooth scrolling. But we _did_ recognize the escape sequences. We don’t, anymore. Thus it makes very little sense to include these escapes in any of our terminfo capabilities. So, remove them.
* csi: DECCOLM+DECSCLM: remove all supportDaniel Eklöf2023-03-31-21/+2
| | | | | | | | | | | We don’t support neither 132 column mode, nor smooth scrolling. Thus it makes little sense to recognize these control condes. Note that while XTerm does support 132 columns, it is disabled by default. In this mode, XTerm also doesn’t trigger the side-effects (i.e. clearing the screen). Closes #1265
* ci (woodpecker): do a second release build, using clang instead of gccDaniel Eklöf2023-03-31-4/+24
|
* input: kitty: don’t treat zero-length utf8/utf32 strings as textDaniel Eklöf2023-03-31-1/+1
| | | | | | This is a regression introduced in 3215d54f31c9e339598a34c9fa43f3dc3c5d1e42 Symptoms: e.g. arrow keys not working in vim/neovim
* changelog: typo: now -> notDaniel Eklöf2023-03-31-1/+1
|
* changeloge: remove bad escape charDaniel Eklöf2023-03-31-1/+1
|
* changelog: remove trailing back-tickDaniel Eklöf2023-03-31-1/+1
|
* test: config: call FcIni() + FcFini()Daniel Eklöf2023-03-31-0/+2
| | | | | | | | | | | | | | | | | Some of the config options we’re testing result in calls to FontConfig APIs. Without calling FcIni()+FcFini(), we leak memory: Direct leak of 768 byte(s) in 3 object(s) allocated from: #0 0x7f7e95cbfa89 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69 #1 0x7f7e95bd1fe5 (/usr/lib/libfontconfig.so.1+0x20fe5) Indirect leak of 96 byte(s) in 3 object(s) allocated from: #0 0x7f7e95cbf411 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:77 #1 0x7f7e95bd63fd (/usr/lib/libfontconfig.so.1+0x253fd) Indirect leak of 19 byte(s) in 2 object(s) allocated from: #0 0x7f7e95c72faa in __interceptor_strdup /build/gcc/src/gcc/libsanitizer/asan/asan_interceptors.cpp:439 #1 0x7f7e95bd1898 in FcValueSave (/usr/lib/libfontconfig.so.1+0x20898)
* term: protect against integer overflow when accumulating scroll damageDaniel Eklöf2023-03-30-7/+13
| | | | | | | | | | | | | | | | | | | When accumulating scroll damage, we check if the last scroll damage’s scrolling region, and type, matches the new/current scroll damage. If so, the number of lines in the last scroll damage is increased, instead of adding a new scroll damage instance to the list. If the scroll damage list isn’t consumed, this build up of scroll damage would eventually overflow. And, even if it didn’t overflow, it could become large enough, that when later used to calculate e.g. the affected surface area, while rendering a frame, would cause an overflow there instead. This patch fixes both issues by: a) do an overflow check before increasing the line count b) limit the line count to UINT16_MAX
* render: protect against integer underflow when calculating scroll areaDaniel Eklöf2023-03-30-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | When applying scroll damage, we calculate the affected region’s height (in pixels), by subtracting the number of rows to scroll, from the scrolling region, and finally multiply by the cell height. If the number of rows to scroll is very large, the subtraction may underflow, resulting in a very large height value instead of a negative one. This caused the check for "scrolling too many lines" to fail. That in turn resulted in an integer overflow when calculating the source offset into the rendered surface buffer, which typically triggered a segfault. This bug happened when there was continuous output in the terminal without any new frames being rendered. This caused a buildup of scroll damage, that triggered the underflow+overflow when we finally did render a new frame. For example, a compositor that doesn’t send any frame callbacks (for example because the terminal window is minimized, or on a different workspace/tag) would cause this. Closes #1305
* input: (kitty kbd): the resulting UTF-8 string may translate to multiple UTF-32 codepointsDaniel Eklöf2023-03-30-12/+32
| | | | | | | | | | | | | | | | | | | | | | | | When this happened (for example, by specifying a custom compose sequence), the kitty keyboard protocol didn’t emit any text at all. This was caused by the utf32 codepoint being -1. This in turned was caused by us trying to convert the utf8 sequence to a *single* utf32 codepoint. This patch replaces the use of mbrtoc32() with a call to ambstoc32(), and the utf32 codepoint with an utf32 string. The kitty keyboard protocol is updated: * When determining if we’re dealing with text, check *all* codepoints in the utf32 string. * Add support for multiple codepoints when reporting "associated text". The first codepoint is the actual parameter in the emitted sequence, and the remaining codepoints are sub-parameters. I.e. the codepoints are colon separated. Closes #1288
* fix typosHarri Nieminen2023-03-28-10/+10
|
* render: fix glitchy selection while resizing the ‘normal’ screenDaniel Eklöf2023-03-27-0/+7
| | | | | | | | | | | The selection coordinates are in absolute row numbers. As such, selection breaks when interactively resizing the normal grid, since we then instantiate a temporary grid mapping directly to the current viewport (for performance reason, to avoid reflowing the entire grid over and over again). Fix by stashing the actual selection coordinates, and ajusting the "active" ones to the temporary grid.
* slave: set $TERM_PROGRAM and $TERM_PROGRAM_VERSION environment variablesCraig Barnes2023-03-20-0/+28
| | | | | | | | | | | | | These are already being set by iTerm2, WezTerm, tmux and likely some others. Even though using yet more environment variables seems rather questionable, if we don't set these we run the risk of inheriting them from other terminals. See also: * https://gitlab.com/gnachman/iterm2/-/blob/97a6078df8e822da165e91737a01c0b9e115dd16/sources/PTYSession.m#L2568-2570 * https://github.com/tmux/tmux/blob/1d0f68dee9f71c504e03616fa472a408a6caa49b/environ.c#L263-L264 * https://github.com/search?q=TERM_PROGRAM&type=code
* config: apply fontconfig rules if user didn’t set an explicit font sizeDaniel Eklöf2023-03-06-6/+38
| | | | | | | | | | | | | | | | | | | | | | | If the user didn’t explicitly set the font size (e.g. font=monospace, instead of font=monospace:size=12), our initial attempt to read the FC_SIZE and FC_PIXEL_SIZE attributes will fail, and we used to fallback to setting the size to 8pt. Change this slightly, so that when we fail to read the FC_*_SIZE attributes, apply the fontconfig rules, but *without expanding* them (i.e. without calling FcDefaultSubstitute()). Then try reading FC_*_SIZE again. If that too fails, _then_ set size to 8pt. This allows us to pick up rules that set a default {pixel}size: <fontconfig> <match> <edit name="pixelsize" mode="append"><double>14</double></edit> </fontconfig> Closes #1287