aboutsummaryrefslogtreecommitdiff
path: root/terminal.h (follow)
Commit message (Collapse)AuthorAgeLines
* term: attributes struct: use ‘bool’ instead of ‘uint32_t’ for 1-bit membersDaniel Eklöf2021-04-18-13/+13
|
* osc: implement OSC 17+19: change selection background/foreground colorsDaniel Eklöf2021-04-18-0/+3
| | | | | And of course, we also implement the corresponding reset sequences, OSC 117+119.
* config/terminal: refactor: remove “default_*” color members from terminal structDaniel Eklöf2021-04-18-4/+0
| | | | Access the original colors in the configuration instead.
* ime: move preedit state from terminal struct to the seat structDaniel Eklöf2021-03-25-15/+2
| | | | | | | | | | | | | | | | | This ensures different seat’s don’t step on each others IME pre-edit state. It also removes most dependencies on having a valid term pointer for many IME operations. We’re still not all the way, since we support disabling IME with a private mode, which is per terminal, not seat. Thus, we still require the seat to have keyboard focus on one of our windows. Closes #324. But note that *rendering* of multiple seat’s IME pre-edit strings is still broken.
* term: increase/decrease custom line-height with font size changesDaniel Eklöf2021-03-21-0/+7
| | | | | | | | When the user has set a custom line-height, we now adjust it when increasing/decreasing (“zooming”) the font size at run-time. Previously, the line-height was fixed at the size specified in foot.ini.
* term: runtime switch between a ‘fast’ and a ‘generic’ ASCII print functionDaniel Eklöf2021-03-16-0/+4
| | | | | | | | | | | | | | | | | | | | | | | term_print() is called whenever the client application “prints” something to the grid. It is called for both ASCII and UTF-8 characters, and needs to handle sixels, insert mode and ASCII vs. graphical charsets. Since it’s on the hot path, this becomes unnecessarily slow. This patch adds a “fast” version of term_print(), tailored for the common case: ASCII characters in non-insert mode, without any sixels and non-graphical charsets. A new function, term_update_ascii_printer(), has been added, and must be called whenever: * The currently selected charset *index* changes * The currently selected charset changes (from ASCII to graphical, or vice verse) * Sixels are added to the grid * Sixels are removed from the grid * Insert mode is enabled/disabled
* sixel: implement P2=1 - transparent pixelsDaniel Eklöf2021-03-11-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | When P2=1, empty pixels are transparent. This patch also changes the behavior of P2=0|2, from setting empty pixels to the default background color, to instead use the *current* background color. To implement this, a couple of changes are needed: * Sixel pixels always use alpha=1.0, except for *empty* cells when P2=1 (i.e. transparent pixels). * The renderer draws sixels with the OVER operator, instead of the SRC operator. * The renderer *must* now render the cells beneath the sixel. As an optimization, this is only done for sixels where P2=1. I.e. for fully opaque sixels, there’s no need to render the cells beneath. The sixel renderer isn’t yet hooked into the multi-threaded renderer. This means *rows* (not just the cells) beneath maybe-transparent sixels are rendered single-threaded. Closes #391.
* sixel: empty pixels in the last sixel row doesn’t contribute to the image heightDaniel Eklöf2021-03-11-0/+1
| | | | | | | | | | | | | | All-empty pixels rows in the last sixel row should not be included in the final sixel image. This allows applications to emit sixels whose height is not a multiple of 6, and is how XTerm works. This is done by tracking the largest row number that contains non-empty pixels. In unhook, when emitting the image, the image height is adjusted based on this value.
* sixel: remove ‘max_col’Daniel Eklöf2021-03-11-1/+0
| | | | The image width *is* the maximum number of columns we’ve seen.
* sixel: get rid of an ‘imul’ in sixel_add()Daniel Eklöf2021-03-11-0/+1
| | | | | | | | By storing the current row’s byte offset into the backing image in the terminal struct. This replaces the ‘imul’ with a load, which can potentially be slow. But, this data should already be in the cache.
* sixel: size provided by DECGRA does *not* limit the sixel sizeDaniel Eklöf2021-03-06-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Foot has, up until now, used a fixed image size when the application used DECGRA (Raster Attributes) to “configure” the image size. This was based on a misunderstanding, that this was how you emitted sixels where the height was *not* a multiple of 6. This isn’t the case. The VT340 documentation is actually pretty clear about this: Ph and Pv do not limit the size of the image defined by the sixel data. However, Ph and Pv let you omit background sixel data from the image definition and still have a color background. They also provide a concise way for the application or terminal to encode the size of an image. This is also how XTerm behaves. Test image: \EPq "1;1;1;1 #0;2;0;0;0#1;2;100;100;0#2;2;0;100;0 #1~~@@vv@@~~@@~~$ #2??}}GG}}??}}??- #1!14@ \E\ This uses DECGRA to set the image size to 1x1. The sixel however is *not* clipped to 1x1, but is resized to 14x12
* sixel: implement private mode 80 - sixel scrollingDaniel Eklöf2021-02-26-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When enabled (the default), sixels behave much like normal output; the start where the cursor is, and the cursor moves with the sixel. I.e. after emitting a sixel the cursor is left after the image; either to the right, if private mode 8452 is enabled, or otherwise on the next line. Terminal content is scrolled up if the sixel is larger than the screen. When disabled, sixels *always* start at (0,0), the cursor never moves, and the terminal content never scrolls. In other words, the ‘disabled’ mode is a much simpler mode. All we need to do to support both modes is re-write the sixel-emitting loop to: * break early if we’re “out of rows”, i.e. we’ve reached the bottom of the screen. * not linefeed, or move the cursor when scrolling is disabled This patch also fixes a bug in the (new) implementation of private mode 8452. When emitting a sixel, we may break it up into smaller pieces, to ensure a single sixel (as tracked internally) does not cross the scrollback wrap-around. The code that checked if we should do a linefeed or not, would skip the linefeed on the last row of *each* such sixel piece. The correct thing to do is to skip it only on the last row of the *last* piece. I chose not to fix this bug in a separate patch since doing so would have meant re-writing it again when implementing private mode 80.
* url-mode: snapshot screen state when entering URL modeDaniel Eklöf2021-02-26-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Previously, we automatically exited URL mode whenever we received data on the PTY. This was done since we don’t know _what_ has changed on the screen, and we don’t want to display misleading jump labels. However, this becomes a problem in curses-like applications that periodically updates part of the screen. For example, a statusbar with a clock. This patch changes this behavior; instead of cancelling URL mode when receiving PTY data, we snapshot the grid when entering URL mode. When *rendering*, we use the snapshot:ed grid, while PTY updates modify the “real” grid. Snapshot:ing the grid means taking a full/deep copy of the current grid, including sixel images etc. Finally, it isn’t necessary to “damage” the entire view when *entering* URL mode, since we’re at that point the renderer is in sync with the grid. But we *do* need to damage the entire view when exiting URL mode, since the grid changes on the “real” grid hasn’t been tracked by the renderer.
* terminal: change type from uint32_t to bool in xtsave bitfieldDaniel Eklöf2021-02-23-26/+26
|
* sixel: implement private mode 8452 - cursor positioning after sixelDaniel Eklöf2021-02-23-0/+3
| | | | | | | | | | When disabled (the default), the cursor is positioned on a new line after emitting a sixel image. When enabled, the cursor is positioned to the right of the sixel image. Closes #363
* sixel: implement private mode 1070 - private color paletteDaniel Eklöf2021-02-23-1/+7
| | | | | | | | | When enabled (the default), sixels use private color registers. That is, the color palette from the last sixel is *not* re-used. When disabled, sixels share (i.e. re-use) the same color palette. Closes #362
* urls: OSC-8 URLs can now optionally be underlined outside of url-modeDaniel Eklöf2021-02-21-0/+1
| | | | | | | | | | | | | | | | | | | | | This patch adds a new configuration option, ‘osc8-underline=url-mode|always’. When set to ‘url-mode’, OSC-8 URLs are only highlighted (i.e. underlined) in url-mode, just like auto-detected URLs. When set to ‘always’, they are always underlined, regardless of mode, and regardless of their other attributes. This is implemented by tagging collected URLs with a boolean, instructing urls_render() and urls_reset() whether they should update the cells’ ‘url’ attribute or not. The OSC-8 collecter sets this based on the value of ‘osc8-underline’. Finally, when closing an OSC-8 URL, the cells are immediately tagged with the ‘url’ attribute if ‘osc8-underline’ is set to ‘always’.
* urls: add key binding that toggles whether URLs are displayed on jump-labelDaniel Eklöf2021-02-21-0/+1
| | | | | | | | | | | | | | | | | By default, the URL isn’t shown on the jump-label. For auto-detect URLs, doing so is virtually always useless, as the URL is already visible in the grid. For OSC-8 URLs however, the URL is often _not_ visible in the grid. Many times, seeing the URL is still not needed (if you’re doing ‘ls --hyperlink’, you already know what the URIs are). But it is still useful to have a way to show the URLs. This patch adds a new key binding action that can be used in url-mode to toggle the URL on and off in the jump label. It is bound to ctrl+t by default.
* urls: remove free-form ‘text’ member from URL structDaniel Eklöf2021-02-21-1/+0
|
* url-mode: multiple URL (parts) with the same ID is assigned a single key sequenceDaniel Eklöf2021-02-21-0/+1
| | | | | | | | | | In case an URL is split up into multiple parts, those parts are now treated as a single URL when it comes to key assignment. Only the *first* URL part is actually assigned a key combo. The other parts are ignored. We still highlight them, but for all other purposes they are ignored.
* term: add an ‘id’ member to the the ‘row_uri_range’ structDaniel Eklöf2021-02-21-0/+1
| | | | | term_osc8_close() sets it from the OSC-8 ID tracked in the VT sub-struct.
* term: add ‘id’ parameter to term_osc8_open()Daniel Eklöf2021-02-21-2/+3
| | | | | The current OSC-8 URL’s ID is now tracked along with the URI itself, and its starting point.
* terminal: add term_osc8_{open,close} functionsDaniel Eklöf2021-02-21-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | These functions update the OSC-8 URI state in the terminal. term_osc8_open() tracks the beginning of an URL, by storing the start coordinate (i.e. the current cursor location), along with the URL itself. Note that term_osc8_open() may not be called with an empty URL. This is important to notice, since the way OSC-8 works, applications close an URL by “opening” a new, empty one: \E]8;;https://foo.bar\e\\this is an OSC-8 URL\E]8;;\e\\ It is up to the caller to check for this, and call term_osc8_close() instead of term_osc8_open() when the URL is empty. However, it is *also* valid to switch directly from one URL to another: \E]8;;http://123\e\\First URL\E]8;;http//456\e\\Second URL\E]8;;\e\\ This use-case *is* handled by term_osc8_open(). term_osc8_close() uses the information from term_osc8_open() to add per-row URL data (using the new ‘extra’ row data).
* terminal: add OSC-8 state tracking to the VT sub-structDaniel Eklöf2021-02-21-2/+12
|
* grid: enable rows to have ‘extra’ data associated with themDaniel Eklöf2021-02-21-0/+11
| | | | | | | | | | | This patch adds an ‘extra’ member to the row struct. It is a pointer to a struct containing extra data to be associated with this row. Initially, this struct contains a list of URL ranges. These define (OSC-8) URLs on this row. The ‘extra’ data is allocated on-demand. I.e. the pointer is NULL by default; it is *not* allocated by grid_row_alloc().
* url-mode: store URL in UTF-8, not UTF-32Daniel Eklöf2021-02-21-1/+1
| | | | | | | | | | | | | The only time the URL is actually in UTF-32 is when we’re collecting it (auto-detecting it) from the grid, since cells store their character(s) in UTF-32. Everything *after* that prefers the URL in UTF-8. So, do the conversion while collecting the URL. This patch also changes the URL activation code to strip the ‘file://user@host/’ prefix from file URIs that refer to files on the *local* computer.
* reaper: monitor SIGCHLD using the FDM instead of via a signalfdDaniel Eklöf2021-02-11-1/+2
| | | | | | | | | | | | | | | | | | | | | | | In addition to letting the FDM do the low-level signal watching, this patch also fixes a bug; multiple SIGCHLDs, be it delivered either through a signal, or via a signalfd, can be coalesced, like all signals. This means we need to loop on waitpid() with WNOHANG until there are no more processes to reap. This in turn requires a small change to the way reaper callbacks are implemented. Previously, the callback was allowed to do the wait(). This was signalled back to the reaper through the callback’s return value. Now, since we’ve already wait():ed, the process’ exit status is passed as an argument to the reaper callback. The callback for the client application has been updated accordingly; it sets a flag in the terminal struct, telling term_destroy() that the process has already been wait():ed on, and also stores the exit status.
* url-mode: fix key sequence generationDaniel Eklöf2021-02-07-1/+1
| | | | | | | | * We were using the ‘back’ element of the list as prefix for the next iteration of sequences, instead of the element at index ‘offset’ * ALEN() on a wchar_t[] includes the NULL terminator. We don’t want that.
* url-mode: urls_collect(): URL list pointer as an argumentDaniel Eklöf2021-02-07-1/+2
|
* url-mode: underline URLs using the color from colors.urlsDaniel Eklöf2021-02-07-1/+2
| | | | | | | | | | | | | | | | | | | | | | This is implemented by allocating one of the (few!) remaining bits in the cells’ attribute struct to indicate the cell should be “URL highlighted”. render_cell() looks at this bit and draws an underline using the color from colors.urls (defaults to regular3 - i.e. yellow). A new function, url_tag_cells(), iterates the currently detected URLs and sets the new ‘url’ attribute flag on the affected cells. Note: this is done in a separate function to keep urls_collect() free from as many dependencies as possible. urls_reset() is updated to *clear* the ‘url’ flag (and thus implicitly also results in a grid refresh, _if_ there were any URLs). We now exit URL mode on *any* client application input. This needs to be so since we can’t know if the URLs we previously detected are still valid.
* term: surface-kind: add TERM_SURF_JUMP_LABELDaniel Eklöf2021-02-07-0/+1
|
* config: add show-urls-copy actionDaniel Eklöf2021-02-07-0/+2
| | | | | | This works just like show-urls-launch, except that instead of opening the URL (typically using xdg-open), it is placed in the clipboard when activated.
* urls: initial support for detecting URLs and rendering jump-labelsDaniel Eklöf2021-02-07-0/+16
| | | | The jump labels work, but is currently hardcoded to use xdg-open
* Send text_input_rectangle requests for text-inputTadeo Kondrak2021-01-29-0/+2
|
* Print stack trace on assert() failure or when calling fatal_error()Craig Barnes2021-01-16-0/+1
| | | | | | Note: this uses the __sanitizer_print_stack_trace() function from the AddressSanitizer runtime, so it only works when AddressSanitizer is in use.
* term: keep cursor state in grid, for now, but document that it _could_ be movedDaniel Eklöf2021-01-15-0/+8
|
* term/vt/csi: break out cursor save/restore to dedicated functionsDaniel Eklöf2021-01-15-0/+1
|
* config: line-height, letter-spacing: values are in pt by default, but we allow pxDaniel Eklöf2021-01-11-0/+2
| | | | | | | | If the value is specified without a unit, then the value is assumed to be in points, subject to DPI scaling. The value can optionally have a ‘px’ suffix, in which case the value is treated as a raw pixel count.
* selection: combine enum selection_kind with selection_semanticDaniel Eklöf2021-01-06-3/+7
|
* selection: allow selections to pivot around a range instead of a pointDaniel Eklöf2021-01-04-0/+5
| | | | | | | | | | Extend selection pivoting to allow selections to pivot around a range. Use this in word- and row-based selections to pivot around the initial word/row that was selected. This mimics the behavior of at least urxvt and xterm.
* selection: remember whether word-wise selection uses spaces only for delimitersDaniel Eklöf2021-01-04-0/+1
|
* selection: wip: update selection row-wise when initial selection was by rowDaniel Eklöf2021-01-04-1/+1
|
* selection: wip: update selection word-wise when initial selection was by wordDaniel Eklöf2021-01-04-0/+2
|
* box-drawing: SEXTANTS, U+1fb00-1fb3bDaniel Eklöf2021-01-01-1/+5
|
* box-drawing: add infrastructure for rendering box drawing characters ourselvesDaniel Eklöf2021-01-01-0/+2
| | | | | | | | * ‘term’ struct contains an array of 160 fcft glyph pointers * the glyph pointers are lazily allocated when we need to draw a box drawings character * Filtering out box drawings characters is easy - they are (except unicode 13, which isn’t handled yet )all in a single range.
* vt: don’t ignore extra private/intermediate charactersDaniel Eklöf2020-12-16-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Take ‘\E(#0’ for example - this is *not* the same as ‘\E(0’. Up until now, foot has however treated them as the same escape, because the handler for ‘\E(0’ didn’t verify there weren’t any _other_ private characters present. Fix this by turning the ‘private’ array into a single 4-byte integer. This allows us to match *all* privates with a single comparison. Private characters are added to the LSB first, and MSB last. This means we can check for single privates in pretty much the same way as before: switch (term->vt.private) { case ‘?’: ... break; } Checking for two (or more) is much uglier, but foot only supports a *single* escape with two privates, and no escapes with three or more: switch (term->vt.private) { case 0x243f: /* ‘?$’ */ ... break; } The ‘clear’ action remains simple (and fast), with a single write operation. Collecting privates is potentially _slightly_ more complex than before; we now need mask and compare, instead of simply comparing, when checking how many privates we already have. We _could_ add a counter, which would make collecting privates easier, but this would add an additional write to the ‘clean’ action which is really bad since it’s in the hot path.
* term: enabling application synchronized updates clear pending grid refreshDaniel Eklöf2020-12-14-1/+0
| | | | | | | | | | | This fixes issues with de-synchronized frames being rendered; we may have scheduled a redraw earlier, that hasn’t yet triggered (probably because we’re waiting for a frame callback), when we enable application synchronized updates. This means we risk rendering a partially updated state when the frame callback finally arrives, if the application hasn’t yet ended its synchronized update.
* config: add ‘notify’ to possible values for ‘bell’ in foot.iniDaniel Eklöf2020-12-10-2/+2
| | | | | When `bell=notify`, foot will trigger a desktop notification when it receives a BEL in an unfocused window.
* ime: store wchar version of pre-edit string in terminal structDaniel Eklöf2020-12-07-0/+1
|
* csi: add DECSET 737769 - enables/disables IME inputDaniel Eklöf2020-12-07-0/+1
| | | | 73 77 69 = I M E
* ime: add functions to enable/disable IME, simplify code that enables IMEDaniel Eklöf2020-12-07-1/+5
| | | | | | | | | | | | | | | | | We may want to be able to enable/disable IME run-time, even though we have received an ‘enter’ IME event. This enables us to do that. Also add functions to enable/disable IME on a per-terminal instance basis. A terminal may have multiple seats focusing it, and enabling/disabling IME in a terminal instance enables/disables IME on all those seats. Finally, the code to enable IME is simplified; the *only* surface that can ever receive ‘enter’ IME events is the main grid. All other surfaces are sub-surfaces, without their own keyboard focus.
* ime: make IME compile-time optionalDaniel Eklöf2020-12-07-0/+4
|
* ime: render pre-edit textDaniel Eklöf2020-12-07-0/+13
| | | | | | | | | | | | | | This is done by allocating cells for the pre-edit text when receiving the text-input::done() call, and populating them by converting the utf-8 formatted pre-edit text to wchars. We also convert the pre-edit cursor position to cell positions (it can cover multiple cells). When rendering, we simply render the pre-edit cells on-top off the regular grid. While doing so, we also mark the underlying, “real”, cells as dirty, to ensure they are re-rendered when the pre-edit text is modified or removed.
* csi: add new private mode that makes the Escape key emit "\E[27;1;27~"Craig Barnes2020-11-29-0/+2
| | | | | | | | | | This mode can be set by client programs with the DECSET, DECRST, XTSAVE and XTRESTORE sequences by using 27127 as the parameter. The sequence "\E[27;1;27~" is encoded in the same way as is done by xterm's "modifyOtherKeys" mode. Even though xterm itself never emits such a sequence for the Escape key, many programs already have support for parsing this style of key sequence.
* term: split cursor blink state into twoDaniel Eklöf2020-11-26-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two different escape sequences that can be used to set the cursor blink state: ‘CSI ? 12 h/l’ and ‘CSI Ps SP q’. Up until now, they both modified the same internal state in foot. This meant you could enable a blinking cursor with e.g. ‘CSI ? 12 h’ and then disable it with ‘CSI 2 SP q’. Since the ‘CSI ? 12’ escapes are used in the civis/cnorm/cvvis terminfo entries, applications often ended up disabling the blink state on exit (typically be emitting ‘cnorm’), requiring users to manually re-enable blinking. By splitting the internal state into two separate states, we can improve the situation. The cursor will blink if at least one of the two have been enabled. The setting in foot.ini sets the default state of the ‘CSI Ps SP q’ escape. This means if the user has enabled blinking in the configuration, the cursor will blink regardless of civis/cnorm/cvvis. Which probably is what the user wants. If the user has NOT enabled blinking, civis/cnorm/cvvis act as intended: cvvis blink, civis and cnorm do not. If an application overrides the cursor blink/style with ‘CSI Ps SP q’, that will override the user’s setting in foot.ini. But most likely that too is intended (for example, the user may have configured the application to use a different cursor style). And, a well written application will emit the ‘Se’ terminfo sequence on exit, which in foot is defined to ‘CSI SP q’, which will reset both the style and blink state to the user configured style/state. Closes #218
* term: remove read-only properties copied from the configDaniel Eklöf2020-11-26-6/+0
| | | | Use the config directly instead.
* term: place frequently accessed members first in term structDaniel Eklöf2020-11-24-35/+34
| | | | To hopefully use the cache better.
* config: add ‘dpi-aware’ option, defaulting to enabledDaniel Eklöf2020-11-19-0/+1
| | | | | | | | | | When disabled, foot no longers uses outputs’ DPI to scale the font. Instead, it uses the outputs’ scaling factor. That is, instead of appending “:dpi=123” to the fontconfig string, modify the “:pixelsize” or “:size” attribute. Closes #206
* csi: implement “CSI ? 1035” - toggle Num Lock overrideDaniel Eklöf2020-11-11-0/+2
| | | | | This adds a num_lock_modifier state to the terminal, and hooks up “CSI?1035h/l” to toggle it.
* config: add font-bold, font-italic and font-bold-italic optionsDaniel Eklöf2020-10-20-1/+1
| | | | | | | | | | These options lets the user configure custom fonts and styles, to use with the bold and italic cell attributes. By default, they are unset, meaning we use the bold/italic variants of the regular font. Closes #169.
* wayland: properly restore window size when being un-tiledDaniel Eklöf2020-10-20-2/+2
| | | | | | | | Bind to xdg-shell version 2 if available, as this enables us to track our window’s ‘tiled’ state in the ‘configure’ events. This in turn allows us to stash the ‘old’ window size when being tiled, to be used again when restoring the window size when un-tiled.
* term: remove unneeded blink.active fieldDaniel Eklöf2020-10-13-1/+0
| | | | We now use the timer FD instead; if it is -1, blinking is not active.
* Merge branch 'scroll-up-down-while-selecting' into masterDaniel Eklöf2020-10-12-0/+7
|\ | | | | | | Closes #149
| * selection: auto-scroll: add SELECTION_SCROLL_NOT as a scroll ‘direction’Daniel Eklöf2020-10-11-1/+1
| |
| * selection: auto-scroll: selection keeps scrolling while mouse is outside gridDaniel Eklöf2020-10-11-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moving the mouse outside the grid while we have an on-going selection now starts a timer. The interval of this timer depends on the mouse’s distance from the grid - the further away the mouse is, the shorter interval. On each timer timeout, we scroll one line, and update the selection. Thus, the shorter the interval, the faster we scroll. The timer is canceled as soon as the mouse enters the grid again, or the selection is either canceled or finalized. The timer FD is created and destroyed on-demand. Most of the logic is now in selection.c. The exception is the calculation of the timer interval, which depends on the mouse’s position. Thus, this is done in input.c. The scroll+selection update logic needs to know a) which direction we’re scrolling in, and b) which *column* the selection should be updated with. If the mouse is outside the grid’s left or right margins, the stored mouse column will be -1. I.e. we don’t know whether the mouse is on the left or right side of the grid. This is why the caller, that starts the timer, must provide this value. The same applies to top and bottom margins, but since we already have the scroll *direction*, which row value to use can be derived from this.
* | csi: implement ‘CSI ? 1042 h/l’ - enable/disable bell-is-urgentDaniel Eklöf2020-10-11-0/+3
|/
* term: remove unused bit in xtsave structDaniel Eklöf2020-10-09-1/+0
|
* bell: optionally render margins in red when receiving BELDaniel Eklöf2020-10-08-0/+2
| | | | | | | | | | | Add anew config option, ‘bell=none|set-urgency’. When set to ‘set-urgency’, the margins will be painted in red (if the window did not have keyboard focus). This is intended as a cheap replacement for the ‘urgency’ hint, that doesn’t (yet) exist on Wayland. Closes #157
* term: add private mode flag ‘’reverse-wrap’Daniel Eklöf2020-10-02-0/+2
|
* render: remove render_refresh_margins()Daniel Eklöf2020-09-29-2/+0
|
* term: add term_damage_cursor() and term_damage_margins()Daniel Eklöf2020-09-29-0/+5
| | | | | | | | | term_damage_cursor() damages the cell where the cursor is currently at. This can be used to ensure the cursor is re-drawn, if there aren’t any other pending updates. term_damage_margins() requests the margins be redrawn the next time we render the grid.
* render: implement render_refresh_margins()Daniel Eklöf2020-09-01-0/+2
| | | | | For now, it will reset term->render.last_buf to NULL, and then calls grid_render() to do a full screen refresh.
* selection: block non-paste data from being sent to client while pastingDaniel Eklöf2020-08-25-1/+7
| | | | | | | | | | While pasting data from the clipboard, block *all* other data from being sent to the client. This includes keyboard and mouse events, but also replies for VT queries. This is particularly important when bracketed paste has been enabled, since then the client will interpret *everything* between the bracketed paste start and end as paste data.
* csi: xtsave/xtrestore: implement \E[?12s and \E[?12rDaniel Eklöf2020-08-18-1/+1
| | | | I.e. save/restore cursor-blink state.
* term: xtsave: store state in a bitfieldDaniel Eklöf2020-08-16-20/+20
| | | | | These shouldn't be accessed in any performance critical paths, so lets save some memory and use a bitfield.
* csi: xtsave: store modes' SET state, not the current stateDaniel Eklöf2020-08-16-11/+14
|
* csi: add xtsave()Daniel Eklöf2020-08-16-6/+27
| | | | This function stores the current state of DECSET private modes.
* Fix some spelling mistakesCraig Barnes2020-08-15-1/+1
|
* config: add mouse specific bind actionsDaniel Eklöf2020-08-14-0/+1
| | | | | | | | | | | | | | | | | | | | This extends the "normal" bind action enum with mouse specific actions. When parsing key bindings, we only check up to the last valid keyboard binding, while mouse bindings support *both* key actions and mouse actions. The new actions are: * select-begin: starts an interactive selection * select-extend: interactively extend an existing selection * select-word: select word under cursor * select-word-whitespace: select word under cursor, where the only word separating characters are whitespace characters. The old hard-coded selection "bindings" have been converted to instead use these actions, via default bindings added to the configuration.
* input: don't crash on mouse motion events on the render timer surfaceDaniel Eklöf2020-08-14-0/+1
|
* selection: adjust start point when the selection changes directionDaniel Eklöf2020-08-12-0/+2
| | | | | | | | | Without this, the initial cell will always be selected, regardless of how the selection is moved to the left or right. With this patch, the initial cell will only be selected while the selection is being made in the original direction. Changing direction of the selection moves the start point to next/previous character.
* config: handle allocation failure explicitlyCraig Barnes2020-08-04-3/+1
|
* term: remove unusued 'damage' listDaniel Eklöf2020-08-04-1/+0
|
* config: add 'hide-when-typing'Daniel Eklöf2020-07-31-0/+2
| | | | | | When enabled, the mouse cursor is hidden when the user types in the terminal. It is un-hidden when the user moves the mouse, or when the window loses keyboard focus.
* user-notification: 'productify' the user-warning systemDaniel Eklöf2020-07-30-6/+0
| | | | | | | | * Rename user_warning to user_notification * Add warning and error types (in addition to the existing deprecated) * Simplify logic when emitting a user notification after forking; we don't need to copy the notification data since we're in a new process and have total control over that memory.
* term: add capability to print warnings *inside* the terminalDaniel Eklöf2020-07-29-0/+6
| | | | | This is intended to be used to print e.g. deprecation warnings inside the terminal, *before* the shell is started.
* Merge branch 'master' into diagonal-dpiDaniel Eklöf2020-07-28-0/+1
|\
| * term: term_surface_kind(): recognize the scrollback indicator sub-surfaceDaniel Eklöf2020-07-26-0/+1
| |
* | term: store current font DPI as a float instead of an integerDaniel Eklöf2020-07-26-1/+1
|/ | | | | FontConfig's DPI is a double, and using a float instead of an integer results in higher resolution.
* Merge branch 'master' into pipe-grid-to-external-toolDaniel Eklöf2020-07-16-2/+0
|\
| * term: remove unused struct definition 'rgb'Daniel Eklöf2020-07-16-2/+0
| |
* | term: add term_scrollback_to_text() and term_view_to_text()Daniel Eklöf2020-07-15-2/+4
| | | | | | | | | | These functions extract the current view, or the entire scrollback as an UTF-8 encoded byte buffer.
* | extract: extract_one: make arguments constDaniel Eklöf2020-07-15-0/+3
|/
* term: don't re-render last cursor cell if cursor was hiddenDaniel Eklöf2020-07-15-0/+1
|
* term: print: write special value CELL_MULT_COL_SPACER to extra cellsDaniel Eklöf2020-07-14-0/+2
| | | | | | When printing a multi-column character, write CELL_MULT_COL_SPACER instead of '0' to both padding cells (when character doesn't fit at the end of the line), and to the cells following the actual character.
* term: rename COMB_CHARS_LO,HI -> CELL_COMB_CHARS_LO,HIDaniel Eklöf2020-07-14-2/+2
|
* term: rename term_formfeed() -> term_carriage_return()Daniel Eklöf2020-07-14-1/+1
|
* render: keep lock while pushing dirty rows to worker queueDaniel Eklöf2020-07-13-1/+0
| | | | | | | | | | | | | | | | Instead of locking the queue for each dirty row we append, and signaling a condition variable, just keep the lock while going through the visible rows. Release the lock once done. Since we take the lock *before* posting the 'start' semaphore, all workers will be waiting for the lock to be released. Then, one at a time they'll get the lock and pick a row to render. The queue will never get empty - when all rows have been rendered, each worker will pick a 'frame done' "job" from the queue, and break the rendering loop.
* render: remove most of the special handling of cursor renderingDaniel Eklöf2020-07-12-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we had to explicitly render the old cursor cell *before* applying scrolling damage. We then rendered all the dirty rows, *without* rendering the cursor - even if the cursor cell was among the dirty rows. Finally, when everything else was done, we explicitly rendered the cursor cell. This meant a lot of code, and unnecessary render_cell() calls, along with unnecessary wl_surface_damage_buffer() calls. This was a necessary in the early design of foot, but not anymore. We can simply mark both the old cursor cell, and the current one, as dirty and let the normal rendering framework render it. All we need to do is pass the cursor column to render_row(), so that it can pass has_cursor=true in the appropriate call to render_cell(). We pass -1 here for all rows, except the cursor's row, where we pass the actual cursor column. With this, there's no need to calculate whether the cursor is visible or not; just mark it's cell as dirty, and if that row is visible, the normal rendering will take care of it. This also simplifies the state needed to be saved between two frames; we only need a row pointer, and the cursor column index. Part of https://codeberg.org/dnkl/foot/issues/35
* term: remove term_has_kbd_focus(), use term->kbd_focus insteadDaniel Eklöf2020-07-11-1/+0
|