aboutsummaryrefslogtreecommitdiff
path: root/terminal.h (follow)
Commit message (Collapse)AuthorAgeLines
* 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
|
* term: cache kbd-focused state, just like we cache visual focus stateDaniel Eklöf2020-07-11-0/+1
| | | | | | There's one difference however, when we receive a kbd unfocus call, *all* seats must have us unfocused before we actually change the state.
* multi-seat: improve handling of multiple (mouse) pointersDaniel Eklöf2020-07-09-2/+13
| | | | | | | | * xcursor always set for all pointers * xcursor sometimes not updated when it should be * mouse grabbed state wasn't per seat, but global (i.e. "does at least one seat enable mouse grabbing") * selection enabled state wasn't per seat
* multi-seat: re-enable mouse button+motion reporting supportDaniel Eklöf2020-07-08-3/+9
|
* wip: multi-seat supportDaniel Eklöf2020-07-08-0/+1
| | | | | Compiles and runs, but mouse, clipboard and other things have been disabled.
* term: don't use deprecated fcft_size_adjust()Daniel Eklöf2020-07-07-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | When resizing the font on-the-fly, we now do a complete font-reload (this is basically what fcft_size_adjust() did anyway). To get the correct size, we maintain the current size ourselves. We get the initial size from the user-provided font pattern, by converting the string to an FcPattern, and using FcPatternGet() to retrieve both the FC_SIZE and FC_PIXEL_SIZE attributes. These attributes are then removed from the pattern, and the pattern is converted back to a string. The terminal struct maintains a copy of the font sizes. These are initially set to the sizes from the config. When the user resizes the font, the terminal-local sizes are adjusted. To ensure the primary and user-configured fallback fonts are resizes equally much, convert any pixel sizes to point sizes at this point. When the font size is reset, we reload the font sizes from the config (thus once again returning actual pixel-sizes, if that's what the user has configured).
* config: add 'blink' option to cursor section in footrcDaniel Eklöf2020-06-30-0/+1
| | | | | This option controls whether the default cursor should blink or not. The default is to *not* blink.
* sixel: if the client has specified a size, do not change thatDaniel Eklöf2020-06-11-0/+1
| | | | | | | | | | | | | We used to auto-resize images to always be a multiple of 6. This is incorrect. The client may, for example, have specified a size to align the image to a cell boundary, which may not be a multiple of 6. Furthermore, in e.g. Jexer, which splits up an image into stripes, that the next image would "overwrite" the previous one. Since the next image was started on a cell row that the previous image had overflowed into.
* vt: initial version of UTF-8 decoding built-in into the VT parserDaniel Eklöf2020-06-07-4/+1
|
* sixel: don't erase image when printing text *next* to it.Daniel Eklöf2020-06-06-0/+1
|
* term: don't double fork new terminal windowsDaniel Eklöf2020-05-21-2/+5
| | | | | Instead, register their PIDs with the new reaper module and let it handle them.
* unicode-combining: limit maximum number of allowed composed chainsDaniel Eklöf2020-05-03-0/+1
|
* unicode-combining: store seen combining chains "globally" in the term structDaniel Eklöf2020-05-03-9/+8
| | | | | | | | | | | | | | | | | | | | Instead of storing combining data per cell, realize that most combinations are re-occurring and that there's lots of available space left in the unicode range, and store seen base+combining combinations chains in a per-terminal array. When we encounter a combining character, we first try to pre-compose, like before. If that fails, we then search for the current base+combining combo in the list of previously seen combinations. If not found there either, we allocate a new combo and add it to the list. Regardless, the result is an index into this array. We store this index, offsetted by COMB_CHARS_LO=0x40000000ul in the cell. When rendering, we need to check if the cell character is a plain character, or if it's a composed character (identified by checking if the cell character is >= COMB_CHARS_LO). Then we render the grapheme pretty much like before.
* unicode-combine: remove utf8proc dependencyDaniel Eklöf2020-05-02-3/+3
| | | | | | | | | | | | We only used utf8proc to try to pre-compose a glyph from a base and combining character. We can do this ourselves by using a pre-compiled table of valid pre-compositions. This table isn't _that_ big, and binary searching it is fast. That is, for a very small amount of code, and not too much extra RO data, we can get rid of the utf8proc dependency.