aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeLines
...
* csi: reduce duplication in code handling SGR 38 and 48 sequencesCraig Barnes2022-04-11-85/+24
|
* doc: ctlseq: document XTMODKEYSDaniel Eklöf2022-04-10-0/+5
|
* changelog: improved compatibility with XTerm when modifyOtherKeys=2Daniel Eklöf2022-04-10-0/+2
|
* input: improve XTerm compatibility when modifyOtherKeys=2Daniel Eklöf2022-04-10-1/+50
| | | | | | | | | | | | | | | | | | | Before this, foot always emitted a CSI if _any_ modifier was active. XTerm doesn’t behave quite like this. Instead, it appears to special-case shift somewhat: If the generated symbol (e.g ‘A’) is the upper case version of the pressed key’s base symbol (‘a’), and is in the range a-z, emit a CSI. If not emit a plain symbol: Examples (Swedish layout): * shift-a (generated symbol is ‘A’) emits a CSI * shift-, (generated symbol is ‘;’) emits ‘;’ * shift-alt-, (generated symbol is ‘;’) emits a CSI Closes #1009
* pgo: fix selection.{start,end} initializersDaniel Eklöf2022-04-10-2/+4
| | | | | This fixes a regression introduced in 5b1f1602bccfb7c37e50a8509f44b24e9aa3b5d1
* search: use a local ‘grid’ variable to hold term->gridDaniel Eklöf2022-04-09-52/+60
|
* refactor: add a ‘range’ struct, grouping a start and end coord togetherDaniel Eklöf2022-04-09-96/+105
|
* config: use fallback when XDG_CONFIG_{HOME,DIRS} is set, but emptyDaniel Eklöf2022-04-07-2/+2
|
* config: fallback to /etc/xdg if XDG_CONFIG_DIRS is unsetDaniel Eklöf2022-04-07-5/+10
| | | | Closes #1008
* config: add tweak option to allow disabling sixelsjvoisin2022-04-06-2/+26
| | | | Closes #950
* osc: avoid unnecessary calls to strlen(3)Craig Barnes2022-04-06-5/+5
| | | | | | | | | | | | | | | | | Checking for specific strings of length 0 or 1 can be done with e.g.: if (str[0] == '\0') {...} if (str[0] == '?' && str[1] == '\0') {...} Doing it this way instead of using strlen(3) means we avoid the function call overhead and also avoid scanning through more of the string than is neceessary. A compiler could perhaps optimize away calls to strlen(3) when the result is compared to a small constant, but GCC 11.2 only seems to actually do this[1] for lengths of 0. [1]: https://godbolt.org/z/qxoW8qqW6
* render: ensure an underline cursor is not positioned too lowDaniel Eklöf2022-04-06-19/+24
| | | | | | | | The underline cursor is positioned just below regular underlines. A bug in the positioning logic related to this, sometimes resulted in the cursor being thinner than what it should be, or even invisible. Fixes #1005
* Small clarification/rewording of default color valuesMerlin Büge2022-04-06-7/+5
| | | | | | | | | This makes the example config `foot.ini` and its man page slightly more coherent regarding the specification of default values. Note that the cursor color is not hardcoded like e.g. foreground or background, thus in the example config, `<inverse foreground/background>` makes more sense.
* doc: fix some small typosMerlin Büge2022-04-06-17/+17
|
* doc: foot.ini: escape ‘-’ and ‘*’Daniel Eklöf2022-04-05-1/+1
|
* foot.ini: fix default value of dpi-aware (it’s ‘auto’)Daniel Eklöf2022-04-05-1/+1
|
* doc: foot.ini: align documented default value of uri-characters with realityDaniel Eklöf2022-04-05-2/+2
| | | | Fixes #1000
* Use circles for rendering light arc box-drawing characters.L3MON4D32022-04-03-114/+216
| | | | | | Ellipses can look weird when the font is narrow. Closes #988
* themes/material-design: add missing bright colorsMariusz Bialonczyk2022-03-29-0/+6
|
* dcs: don’t automatically buffer anythingDaniel Eklöf2022-03-21-5/+0
| | | | | | | | If a request handler doesn’t define its own put() handler, simply drop all DCS parameter data. This way, we won’t end up allocating potentially large buffers for unsupported/unimplemented DCS requests. Closes #959
* dcs: xtgettcap: use custom put() handlerDaniel Eklöf2022-03-21-5/+21
| | | | | Grow buffer exponentially, since XTGETTCAP requests can, theoretically, be very large.
* dcs: decrqss: use a custom put() handlerDaniel Eklöf2022-03-21-22/+36
| | | | | Only buffer up to two bytes, as that’s the largest DECRQSS request we support.
* dcs: map BSU/ESU unhook handlers directly to term_{enable,disable}_app_sync_upates()Daniel Eklöf2022-03-21-26/+7
| | | | That is, drop the local bsu() and esu() functions.
* vt: free OSC buffer after dispatch, if larger than 4KDaniel Eklöf2022-03-21-3/+12
|
* input: don’t allow non-significant modifiers when matching untranslated symbolsDaniel Eklöf2022-03-20-9/+33
| | | | | | | | | | | | | | | | | | When matching “untranslated” bindings (by matching the base symbol of the key, e.g. ctrl+shift+2 in US layout), require that no non-significant modifiers are active. This fixes an issue where AltGr was “ignored”, and would cause certain combinations to match a key binding. Example: ctrl+altgr+0, on many European layouts matched against the default ctrl+0 (reset the font size), instead of emitting ^] To make this work, we now need to filter out “locked” modifiers (e.g. NumLock and CapsLock). Otherwise having e.g. NumLock active would prevent *all* untranslated matching to fail. Closes #983
* char32: only include stdc-predef.h if it is availableDaniel Eklöf2022-03-19-1/+5
| | | | | | | | Use the (relatively new) macro __has_include() to check if stdc-predef.h exists, and only include it if it does. If stdc-predef.h does not exist, or if the compiler does not implement __has_include(), stdc-predef.h is *not* included.
* char32: add missing header to work with muslLeonardo Neumann2022-03-19-0/+1
|
* themes: add material-designMariusz Bialonczyk2022-03-19-0/+18
|
* selection: don’t translate \r to \n when pastingDaniel Eklöf2022-03-19-7/+4
| | | | | | | | | | | | | | | | | In non-bracketed paste mode, we translate \n to \r, and \r\n to \r. The latter matches XTerm, urxvt, alacritty and kitty. The former matches alacritty and kitty (xterm and urxvt just blindly replaces all \n occurrences with \r, meaning \r\n is translated to \r\r. For some reason, we then unconditionally translated all \r back to \n, regardless of whether bracketed paste was enabled or not. Unsure why/where this comes from, but it doesn't match any of the other terminal emulators I tested. One example where this caused issues is in older versions of nano (at least up to 2.9). Closes #980
* csi: add support for DECNKM private modeCraig Barnes2022-03-19-0/+17
| | | | | | | | | | | This is equivalent to DECKPAM/DECKPNM when enabled/disabled, but can also be saved/restored/queried with XTSAVE/XTRESTORE/DECRQM. See also: * https://vt100.net/docs/vt510-rm/DECNKM.html * https://vt100.net/docs/vt510-rm/DECKPAM.html * https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-PC-Style-Function-Keys
* Merge branch 'nord-and-rezza-themes'Daniel Eklöf2022-03-13-0/+79
|\
| * add rezza themeMariusz Bialonczyk2022-03-11-0/+37
| |
| * add Nord themeMariusz Bialonczyk2022-03-11-0/+42
| |
* | foot.ini: change vim modeline from ‘conf’ to ‘dosini’merkix2022-03-13-1/+1
| |
* | osc: use four digits in OSC-4 and OSC-11 rgb:r/g/b repliesDaniel Eklöf2022-03-13-4/+8
| | | | | | | | Closes #971
* | Merge branch 'osc-buffer-growth'Craig Barnes2022-03-13-3/+13
|\ \ | |/ |/|
| * osc: grow OSC buffer exponentially instead of by fixed increments of 128Craig Barnes2022-03-02-3/+13
| | | | | | | | | | | | With fixed increments of 128 bytes, an OSC 52 copy operation could end up doing thousands or tens of thousands of realloc(3) calls just to copy a few MB.
* | input: get_current_modifiers(): don’t crash if seat has no keyboardDaniel Eklöf2022-03-04-6/+19
| | | | | | | | Closes #963
* | dcs: prevent possibility of out-of-bounds reads in decrqss()Craig Barnes2022-03-02-4/+4
|/ | | | | | | | | | This could be triggered by running, for example: printf '\033P$qrxyz\033\\' ...which would cause a memcmp() of 4 bytes on a 2 byte string literal. Fixes: #960
* Wrap setlocale in asserts since it can failjvoisin2022-02-27-4/+12
|
* Add JetBrains Darcula themeEnes Hecan2022-02-27-0/+28
|
* meson: stop using deprecated functions, require meson >= 0.58Daniel Eklöf2022-02-27-7/+8
| | | | | | * get_pkgconfig_variable() -> get_variable() * prog.path() -> prog.full_path() * meson.build_root() -> meson.global_build_root()
* Merge branch 'socket-activation'Daniel Eklöf2022-02-27-29/+147
|\ | | | | | | Closes #604
| * Install notes regarding systemd unit filesMax Gautier2022-02-26-1/+1
| |
| * Socket activation changelog entryMax Gautier2022-02-26-1/+1
| |
| * Document socket activation featureMax Gautier2022-02-26-1/+17
| | | | | | | | - Particular mention to included systemd user units
| * Adding systemd unit files for socket activationMax Gautier2022-02-26-0/+37
| | | | | | | | | | | | | | | | | | | | - Support for multiples concurrent instances, templated on WAYLAND_DISPLAY - Use standard input for the socket file descriptor (inetd style) - Always use the socket provided by systemd with the systemd user service - wayland-instance@.target is intended to be a special target a bit like graphical-session.target.
| * Make foot able to receive a socket from its parentMax Gautier2022-02-26-26/+91
|/ | | | | | | If the argument to --server is parsed as a number, consider it to be a file descriptor, and use that as a socket. This is necessary to be able to use socket activation with the server mode of foot.
* Merge branch 'scrollback-home-and-end'Daniel Eklöf2022-02-24-90/+86
|\
| * config/input: add scrollback-home|end key bindings (unbound by default)Daniel Eklöf2022-02-23-0/+26
| |
| * commands: refactor scrollback up/downDaniel Eklöf2022-02-23-90/+60
|/ | | | | | | | | | | | | | | | | | | | | | | | | When moving the viewport in the scrollback (i.e. “scrolling”), we need to ensure the viewport is not moved past the beginning, or end, of the scrollback. This was previously accomplish by first limiting the number of lines to scroll to the number of visible rows (i.e the viewport _size_), and by adjusting the viewport after moving it, to ensure it doesn’t point into an uninitialized scrollback area etc. I.e. the implementation was _reactive_. This patch rewrites the logic to be _proactive_; we now calculate _where_ the beginning (or end) of the scrollback is, and then how many lines there is from there, to the viewport. This is our _maximum_ number of lines to scroll. When done correctly (which I hope this patch does), this allows us to remove _all_ checks after moving the viewport - we already _know_ it’s correct, and valid. As a bonus, we can remove the old limit, where scrolling was only allowed to be at most a single page.
* Merge branch 'custom-input-escapes'Daniel Eklöf2022-02-18-22/+221
|\ | | | | | | Closes #325
| * doc: foot.ini: document the new [text-bindings] sectionDaniel Eklöf2022-02-16-0/+31
| |
| * foot.ini: move [text-bindings] section, and update exampleDaniel Eklöf2022-02-16-3/+3
| | | | | | | | Use Super+c -> Ctrl+c as example
| * changelog: remapping input to custom escape sequencesDaniel Eklöf2022-02-16-0/+2
| |
| * config: do key binding collision handling in overridesDaniel Eklöf2022-02-16-18/+19
| | | | | | | | | | This ensures we detect, and handle, collisions also for key-bindings specified as overrides.
| * tests: config: initial tests for text-bindingsDaniel Eklöf2022-02-16-0/+37
| |
| * wip: map key combos to custom text strings (including escapes)Daniel Eklöf2022-02-16-4/+132
|/ | | | | | | | | | | | | With this, it is now possible to map key combos to custom escapes. The new bindings are defined in a new section, “text-bindings”, on the form “string=key combo”. The string can consist of printable characters, or \xNN style hex digits: [text-bindings] abcd = Control+a \x1b[A = Control+b Control+c Control+d # map ctrl+b/c/d to UP
* main: --server: don’t exit with code 0 on failureDaniel Eklöf2022-02-16-4/+7
| | | | | | | | | | | | | | | | | | A foot --server instance would exit with code 0, even on failure, if the number of currently open terminal instances were 0. This is because ‘ret’ assumed failure, and then tried to set it to ‘success’ after the even loop had terminated, basted on the server’s current state. Fix by: * set ‘ret’ to success just before entering the event loop * set ‘ret’ to failure when we detect an FDM failure * don’t try to second-guess success/failure after having exited the event loop Closes #943
* Merge branch 'terminfo-sync-2026'Craig Barnes2022-02-16-5/+5
|\
| * doc: ctlseq: recommend using DECSET 2026 for synchronized updatesCraig Barnes2022-02-16-4/+4
| | | | | | | | | | | | Instead of the somewhat problematic[1] DCS-based equivalent. [1]: https://codeberg.org/dnkl/foot/issues/459
| * terminfo: use DECSET 2026 instead of DCS sequences for Sync capabilityCraig Barnes2022-02-16-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Even though it makes little difference to foot which is used in the terminfo entry, DECSET 2026 has some advantages[1] over the DCS sequences and we should probably promote the better of the 2 where possible. Note: the terminfo string was taken from Nicholas Marriott's suggestion[2] in the terminal-wg discussion. [1]: https://codeberg.org/dnkl/foot/issues/459 [2]: https://gitlab.freedesktop.org/terminal-wg/specifications/-/merge_requests/2#note_973680
* | csi: fix case label typo in decrqm()Craig Barnes2022-02-16-1/+1
|/ | | | | | | | | | The other functions that deal with private modes all use 1070 for term->sixel.use_private_palette. The xterm docs[1] also list this param as 1070: > Ps = 1 0 7 0 ⇒ use private color registers for each graphic Using 1079 seems to have been a mistake in commit 4aa980a6a2ce3c3.
* doc: ctlseq: tweak formatting of OSC 22 sequence slightly, for clarityCraig Barnes2022-02-15-1/+1
| | | | | Having 3 separately underlined words made it look a bit like 3 separate parameters, at a glance.
* doc: ctlseq: make OSC 8 formatting consistent with other sequencesCraig Barnes2022-02-15-3/+3
|
* Explicitly initialize sigaction::sa_mask members with sigemptyset(3)Craig Barnes2022-02-12-6/+16
| | | | | | | | | | | | | | | | | | | | Not doing so before calling sigaction(3) is "undefined" according to POSIX[1]: > Applications shall call either sigemptyset() or sigfillset() at least > once for each object of type sigset_t prior to any other use of that > object. If such an object is not initialized in this way, but is > nonetheless supplied as an argument to any of pthread_sigmask(), > sigaction(), sigaddset(), sigdelset(), sigismember(), sigpending(), > sigprocmask(), sigsuspend(), sigtimedwait(), sigwait(), or > sigwaitinfo(), the results are undefined. The use of designated initializers means that sa_mask members were still being initialized, but sigset_t is an opaque type and implicit initialization doesn't necessarily produce the same results as using sigemptyset(3) (although it typically does on most implementations). [1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaddset.html
* osc: don’t damage the entire view on a single color palette updateDaniel Eklöf2022-02-10-1/+41
| | | | | Instead, loop the viewport and dirty only those cells that are affected by the palette change.
* Merge branch 'remove-decset-27127'Craig Barnes2022-02-09-17/+6
|\
| * csi/input: remove private mode 27127Craig Barnes2022-02-09-17/+6
| | | | | | | | This effectively reverts commit 31c73f0cf01e1d0bdcd1435136b010c1c1ab442c.
* | meson: fcft-3.0.0 is buggy, require 3.0.1Daniel Eklöf2022-02-09-1/+1
|/ | | | | | | Fcft-3.0.0 is known to cause crashes. We don’t want anyone ever compiling foot against it. Closes #935
* Merge branch 'refactor-key-bindings'Daniel Eklöf2022-02-09-171/+223
|\
| * config: rename csd.color.close -> quitDaniel Eklöf2022-02-09-4/+4
| | | | | | | | | | | | | | | | | | | | | | This fixes a compilation error on FreeBSD: ../../foot/render.c:2055:45: error: no member named 'epoll_shim_close' in 'struct config::(anonymous at ../../foot/config.h:254:9)' conf_color = &term->conf->csd.color.close; ~~~~~~~~~~~~~~~~~~~~~ ^ /usr/local/include/libepoll-shim/epoll-shim/detail/common.h:8:15: note: expanded from macro 'close': #define close epoll_shim_close
| * input/search/url: pass pointer-to key-binding struct to execute()Daniel Eklöf2022-02-09-25/+28
| |
| * config: ‘pipe’ is now optional ‘aux’ data in the key-binding structDaniel Eklöf2022-02-09-83/+116
| | | | | | | | | | This allows us to add helper functions that e.g. compare bindings’ aux data in a generic way.
| * config: rename enum config_key_binding_type -> key_binding_typeDaniel Eklöf2022-02-09-7/+7
| |
| * input: call wayl_bindings_reset() when receiving a new keymapDaniel Eklöf2022-02-09-9/+1
| |
| * wayland: add wayl_bindings_reset()Daniel Eklöf2022-02-09-5/+13
| | | | | | | | | | This function resets (clears) all key- and mouse-bindings associated with the seat.
| * wayland: use key_bindings_destroy() to destroy the mouse bindingsDaniel Eklöf2022-02-09-3/+7
| |
| * wayland: unify key- and mouse-binding structsDaniel Eklöf2022-02-09-36/+46
| |
| * config: move structs and enums used by config from terminal.h -> config.hDaniel Eklöf2022-02-09-11/+13
|/
* foot.ini: add modeline so vim uses # comments instead of ;Johannes Altmanninger2022-02-09-0/+2
| | | | | | | | | | | | | | | | | Editors like Vim and Kakoune ship filetypes dosini and ini respectively. Both use ";" as comment character, which is used for example by Vim's "gq" command which wraps lines while preserving comment prefixes. foot only accepts # comments. I think it's desirable to stick to a single commenting style (easier to diff configs). Make Vim accept that by adding modeline to use the "conf" filetype, which is for "generic Unix config files". We already have an Emacs modeline at the top, but Vim seems to ignore it. Kakoune doesn't have that filetype, but a patch has been proposed to use # whenever it already occurs in the file, see https://github.com/mawww/kakoune/pull/4537
* Merge branch 'fallback-mouse-cursor'Daniel Eklöf2022-02-07-3/+15
|\ | | | | | | Closes #738
| * changelog: fallback xcursorAshish SHUKLA2022-02-07-1/+1
| |
| * Specify a fallback mouse cursorAshish SHUKLA2022-02-07-2/+8
| | | | | | | | | | `text' cursor is not available in lots of cursor themes, but `xterm' is, so specify `xterm' as a fallback cursor name.
| * pgo: add stub for render_xcursor_is_validAshish SHUKLA2022-02-07-0/+6
|/
* doc: ctlseq: OSC-22Daniel Eklöf2022-02-07-0/+4
|
* changelog: OSC-22Daniel Eklöf2022-02-07-0/+5
|
* osc: implement OSC-22 - set xcursor pointerDaniel Eklöf2022-02-07-0/+4
|
* term: add term_set_user_mouse_cursor()Daniel Eklöf2022-02-07-0/+17
| | | | | | | | | This function allows setting a custom mouse cursor. This is done by adding a ‘char*’ member to the term struct. When it is non-NULL, we *always* use that pointer (the exception being when the pointer is hidden), while the pointer is over the grid. This is instead of the hand/beam pointers we otherwise would use.
* render: add render_xcursor_is_valid()Daniel Eklöf2022-02-07-1/+11
| | | | | Returns true if the provided cursor name is non-NULL, and exist in the currently loaded xcursor theme.
* render: call wl_cursor_theme_get_cursor() earlierDaniel Eklöf2022-02-07-8/+13
| | | | | | | | | | | | | | | | | | | | | Before this patch, wl_cursor_theme_get_cursor() was called in the FDM hook, just before we’re about to update the mouse cursor “for real”. This relies on seat->pointer.xcursor still being valid. This is true as long as we’re only using our compiled-in static xcursor names, but not otherwise. Now, we call wl_cursor_theme_get_cursor() in render_xcursor_set(). At this point, we *know* seat->pointer.xcursor is valid. There is a slight chance of added overhead here, if the client application is switching mouse grabbing on/off rapidly. Before, the calls to wl_cursor_theme_get_cursor() would automatically be throttled. However, the main point of delaying the actual pointer update to the FDM hook is to throttle the *Wayland* calls. And this is still happening: wl_cursor_theme_get_cursor() is client-side only.
* Merge branch 'pipe-scrollback-crash'Daniel Eklöf2022-02-07-10/+21
|\ | | | | | | Closes #926
| * changelog: crash in pipe-scrollbackDaniel Eklöf2022-02-07-0/+2
| |
| * term: scrollback-to-text: crash when trying to extract the entire scrollbackDaniel Eklöf2022-02-07-10/+19
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | We calculated the ‘start’ row by adding the number of screen rows to the current grid offset. This works in most cases. But not when the offset is close to the wrap-around. This triggered a crash when we tried to access a row number larger than the number of available grid rows. Fix by bounding the start row to the number of grid rows. This unearthed a second bug, where trying to extract the scrollback resulted in nothing getting copied. The extraction logic did: for (r = start; r != (end + 1); r++) .... This works, as long as end isn’t start-1. When we try to extract the entire scrollback, it _is_ start-1. Fix by rewriting the loop logic to check for r==end *after* copying the row contents, but *before* incrementing r. Closes #926
* Merge branch 'selection-handling-during-reflow'Daniel Eklöf2022-02-07-30/+67
|\ | | | | | | Closes #924
| * changelog: scrollback wrap-around crossing selectionsDaniel Eklöf2022-02-07-0/+2
| |
| * selection: foreach: sort start/end based on their scrollback-start relative valuesDaniel Eklöf2022-02-07-20/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When iterating the characters in a selection, we want to go from the “start” to the “end”, where start is the upper left-most character, and “end” is the lower right-most character. There are two things to consider: * The ‘start’ coordinate may actually sort after the ‘end’ coordinate (user selected from bottom of the window and upward) * The scrollback wraparound. What we do is calculate both the star and end coordinates’ scrollback-start relative row numbers. That is, the number of rows from the beginning of the scrollback. So if the very first row (i.e. the oldest) in the scrollback is selected, that has the scrollback-start relative number “0”. Then we loop from whichever (start or end coordinate) is highest up in the scrollback, to the “other” coordinate.
| * grid: reflow: add TODO to detect selection on re-used rows, and cancel itDaniel Eklöf2022-02-07-0/+7
| |
| * selection: ensure start/end coordinates are bounded by the current gridDaniel Eklöf2022-02-07-10/+2
| | | | | | | | Closes #924
* | tests: fix typo in error messageCraig Barnes2022-02-07-1/+1
|/