aboutsummaryrefslogtreecommitdiff
path: root/terminal.c (follow)
Commit message (Collapse)AuthorAgeLines
* Fix commentOleh Hushchenkov2021-04-18-3/+1
|
* term: stop reading on eofOleh Hushchenkov2021-04-18-0/+5
|
* term/vt: only do reverse-wrapping (‘bw’) on cub1Daniel Eklöf2021-04-18-38/+3
| | | | | | | | | | | | | | Foot currently does reverse-wrapping (‘auto_left_margin’, or ’bw’) on everything that calls ‘term_cursor_left()’. This is wrong; it should only be done for cub1. From man terminfo: auto_left_margin | bw | bw | cub1 wraps from column 0 to last column This patch moves the reverse-wrapping logic from term_cursor_left() to the handling of BS (backspace). Closes #441
* osc: implement OSC 17+19: change selection background/foreground colorsDaniel Eklöf2021-04-18-0/+6
| | | | | And of course, we also implement the corresponding reset sequences, OSC 117+119.
* osc: reset background alpha when resetting the background colorDaniel Eklöf2021-04-18-0/+1
|
* terminal: drain PTY when client terminatesDaniel Eklöf2021-04-18-4/+9
| | | | | | | | | | This is done by: * Not limiting the number of times we try to read from the PTY when we’ve have POLLHUP * Not requiring the entire the previous read to have filled our buffer. * Not erroring out on EIO.
* config/terminal: refactor: remove “default_*” color members from terminal structDaniel Eklöf2021-04-18-45/+6
| | | | Access the original colors in the configuration instead.
* term: free vt.osc8.uri when destroying a terminalDaniel Eklöf2021-04-18-0/+2
| | | | | Free vt.osc8.uri in term_destroy(), in the off chance, that the client application emitted an un-terminated OSC-8 URI.
* ime: move preedit state from terminal struct to the seat structDaniel Eklöf2021-03-25-20/+20
| | | | | | | | | | | | | | | | | 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: term_print(): clear line break flagDaniel Eklöf2021-03-23-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The line break flag is used by the text reflow and text extraction (i.e. copy-paste) logic, to determine whether or not to insert a newline between two lines. There’s some amount of heuristics involved in this. For example, the client application could emit a newline, move the cursor back up, and print text. What does that mean for us? Foot’s behavior up until now has been this: The line break flag is set on the row, when the application emits an explicit linefeed. The flag is cleared when the line is erased. But otherwise not. This meant that emitting a linefeed and then moving the cursor back up and printing text, did not clear the line break flag. This in turn meant that text copied always had newlines inserted, even though that was not the client applications intention. By clearing the line break flag whenever _anything_ is printed to a row, the new behavior is, in practice, that the line break flag is only set on a row if a linefeed was that *last* thing printed to that row. Closes #410
* term: increase/decrease custom line-height with font size changesDaniel Eklöf2021-03-21-2/+13
| | | | | | | | 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: update_ascii_printer(): log when we (actually) switch printerDaniel Eklöf2021-03-16-1/+11
|
* term: runtime switch between a ‘fast’ and a ‘generic’ ASCII print functionDaniel Eklöf2021-03-16-0/+64
| | | | | | | | | | | | | | | | | | | | | | | 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
* term: term_print(): assume we’re *not* at the right marginDaniel Eklöf2021-03-14-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | That is, assume we can, and should, increment the cursor column. This changes the emitted assembly from: 518fb: 8b 8b f8 05 00 00 mov 0x5f8(%rbx),%ecx 51901: ff c9 dec %ecx 51903: 39 d1 cmp %edx,%ecx 51905: 7e 11 jle 51918 <term_print.constprop.0+0x78> 51907: ff c2 inc %edx 51909: 89 50 10 mov %edx,0x10(%rax) 5190c: 5b pop %rbx 5190d: 5d pop %rbp 5190e: 41 5c pop %r12 51910: c3 ret 51911: 0f 1f 80 00 00 00 00 nopl 0x0(%rax) 51918: c6 40 18 01 movb $0x1,0x18(%rax) 5191c: 5b pop %rbx 5191d: 5d pop %rbp 5191e: 41 5c pop %r12 51920: c3 ret To: 5191c: 41 8d 50 01 lea 0x1(%r8),%edx 51920: 89 50 10 mov %edx,0x10(%rax) 51923: 3b 93 f8 05 00 00 cmp 0x5f8(%rbx),%edx 51929: 0f 8d 21 01 00 00 jge 51a50 <term_print.constprop.0+0x190> 5192f: 5b pop %rbx 51930: 5d pop %rbp 51931: 41 5c pop %r12 51933: c3 ret ... 51a50: c6 40 18 01 movb $0x1,0x18(%rax) 51a54: 44 89 40 10 mov %r8d,0x10(%rax) 51a58: 5b pop %rbx 51a59: 5d pop %rbp 51a5a: 41 5c pop %r12 51a5c: c3 ret I.e. it cuts the normal path from 10 instructions down to 8. It increases the "bad" path with one extra instruction.
* term: don’t close PTY when client application diesDaniel Eklöf2021-03-12-10/+2
| | | | | | | | | Closing it as soon as we detect that the client has died, means we may not have drained it completely. The PTY is either closed _by_ the client application, or by us when we shutdown the terminal. Thus, leaving it open (until we call term_shutdown()) is fine.
* sixel: implement private mode 80 - sixel scrollingDaniel Eklöf2021-02-26-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* grid: grid_free(): free scroll damage listDaniel Eklöf2021-02-26-3/+0
|
* url-mode: snapshot screen state when entering URL modeDaniel Eklöf2021-02-26-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* grid: add grid_free()Daniel Eklöf2021-02-26-14/+2
|
* terminal: erase_cell_range: erase URI ranges affected by the erase.Daniel Eklöf2021-02-23-2/+52
| | | | | * Partially affected URI ranges are split up * Completely covered URI ranges are removed
* sixel: implement private mode 1070 - private color paletteDaniel Eklöf2021-02-23-0/+1
| | | | | | | | | 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-1/+13
| | | | | | | | | | | | | | | | | | | | | 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’.
* terminal: osc8_close(): refactor: use grid_row_add_uri_range()Daniel Eklöf2021-02-21-5/+1
|
* terminal: scroll: use grid_row_reset_extra()Daniel Eklöf2021-02-21-16/+2
|
* term: osc-8: close: ignore zero-length URLsDaniel Eklöf2021-02-21-0/+5
| | | | | | | | | | If the client application emitted e.g: \E]8;;http://foo\E\\\E]8;;\E\\ i.e. an anchor without content, then we ended up with an ‘end’ coordinate that lied *before* the ‘start’ coordinate, since we subtract one (column) from the end point to make it inclusive.
* term: osc-8: open: typo: close previous URL if ‘begin’ coords are *non-negative*Daniel Eklöf2021-02-21-1/+1
|
* term_osc8_close(): the URL *end* column is inclusiveDaniel Eklöf2021-02-21-0/+6
|
* 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-1/+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/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+6
|
* grid: enable rows to have ‘extra’ data associated with themDaniel Eklöf2021-02-21-4/+24
| | | | | | | | | | | 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().
* wayland: drop ‘_surface’ suffix from subsurface struct instancesDaniel Eklöf2021-02-17-3/+3
|
* render-timer: use wayl_win_subsurface_new/destroy()Daniel Eklöf2021-02-17-1/+1
|
* scrollback-indicator: use wayl_win_subsurface_new/destroy()Daniel Eklöf2021-02-17-1/+1
|
* search: use wayl_win_subsurface_new/destroy()Daniel Eklöf2021-02-17-1/+1
|
* csd: use wayl_win_subsurface_new/destroy()Daniel Eklöf2021-02-17-8/+8
|
* url-mode: convert struct wl_url to use wayl_win_subsurface_new()Daniel Eklöf2021-02-17-1/+1
|
* reaper: monitor SIGCHLD using the FDM instead of via a signalfdDaniel Eklöf2021-02-11-51/+59
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Convert some uses of xassert(false) to BUG("some error message")Craig Barnes2021-02-09-6/+5
|
* misc: when free:ing tll lists, prefer tll_remove() over tll_free()Daniel Eklöf2021-02-08-13/+20
| | | | | | | | | | | | | | | | | | | In many places we have the following pattern: tll_foreach(list, it) free(it->item.thing); tll_free(list); Since all tll functions are macros, and thus inlined, and since tll_free in itself expands to a tll_foreach(), the above pattern expands to more native code than necessary. This is somewhat smaller: tll_foreach(list, it) { free(it->item.thing); tll_remove(list, it); }
* url-mode: underline URLs using the color from colors.urlsDaniel Eklöf2021-02-07-0/+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-1/+6
|
* term: destroy: set term->window = NULL after destroying itDaniel Eklöf2021-02-07-1/+3
| | | | | | This fixes a crash in urls_reset() on destroy, where we tried to access an already free:d window pointer in order to destroy the jump label surfaces.
* urls: initial support for detecting URLs and rendering jump-labelsDaniel Eklöf2021-02-07-0/+3
| | | | The jump labels work, but is currently hardcoded to use xdg-open
* selection: remove selection_enabled()Daniel Eklöf2021-02-02-1/+4
| | | | | Its name did not reflect its semantics. Since it was only used in a single place, “inline” it there, and get rid of it.
* term: term_mouse_grabbed: return true if mouse tracking is disabledDaniel Eklöf2021-02-02-3/+4
|
* Send text_input_rectangle requests for text-inputTadeo Kondrak2021-01-29-0/+16
|
* Merge branch 'mouse-button-encoding-of-button-6-7'Daniel Eklöf2021-01-23-5/+1
|\
| * terminal: fix encoding of mouse buttons 6 and 7 in mouse eventsDaniel Eklöf2021-01-22-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These two buttons were encoded using the *exact* same numbers as button 4 and 5 (scroll wheel up/down), making it impossible to distinguish them. The relevant section from XTerm’s control sequences documentation is: Some wheel mice can send additional button events, e.g., by tilting the scroll wheel left and right. Additional buttons are encoded like the wheel mice, o by adding 64 (for buttons 6 and 7), or o by adding 128 (for buttons 8 through 11).
* | terminal: add/exclude missing headersJan Beich2021-01-21-0/+3
|/ | | | | | | | | | | | terminal.c:3:10: fatal error: 'malloc.h' file not found #include <malloc.h> ^~~~~~~~~~ terminal.c:1512:9: error: implicit declaration of function 'sigaction' is invalid in C99 [-Werror,-Wimplicit-function-declaration] sigaction(SIGALRM, &(const struct sigaction){.sa_handler = &sig_alarm}, NULL); ^ terminal.c:1532:21: error: implicit declaration of function 'kill' is invalid in C99 [-Werror,-Wimplicit-function-declaration] kill(term->slave, kill_signal); ^
* debug: rename assert() to xassert(), to avoid clashing with <assert.h>Craig Barnes2021-01-16-44/+44
|
* Print stack trace on assert() failure or when calling fatal_error()Craig Barnes2021-01-16-1/+1
| | | | | | Note: this uses the __sanitizer_print_stack_trace() function from the AddressSanitizer runtime, so it only works when AddressSanitizer is in use.
* term/vt/csi: break out cursor save/restore to dedicated functionsDaniel Eklöf2021-01-15-0/+12
|
* term: remove client application’s pid from reaper when shutting downDaniel Eklöf2021-01-12-0/+3
| | | | | | | | | | When we are shutting down the terminal, we explicitly wait for the child application to terminate (with a timeout, after which the child process is killed). I.e. there’s no need to let the reaper handle it. In fact, doing so leads to a crash since we will have destroyed (and thus free:d) the terminal instance when the reaper callback is called.
* config: pt_or_px cannot be a unionDaniel Eklöf2021-01-11-1/+1
|
* term: use pt_or_px_as_pixels()Daniel Eklöf2021-01-11-12/+4
|
* term: add pt_or_px_as_pixels()Daniel Eklöf2021-01-11-0/+9
| | | | | This function takes a ‘union pt_or_px’ and converts its value to a pixel value.
* config: line-height, letter-spacing: values are in pt by default, but we allow pxDaniel Eklöf2021-01-11-6/+21
| | | | | | | | 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.
* config: letter-spacing: make this a relative valueDaniel Eklöf2021-01-11-4/+5
| | | | | | | | 0, the default, means no additional spacing; the cell width is defined by the font metrics. A positive value *adds* to the width from the font metrics, while a negative value *subtracts*.
* term: set_fonts: use custom line-height+letter-spacing, if setDaniel Eklöf2021-01-11-4/+8
| | | | | If the user has configured a custom line-height and/or letter-spacing, use that instead of the font metrics.
* term: clear box drawing glyph cache when reloading fontsDaniel Eklöf2021-01-01-0/+8
|
* box-drawing: add infrastructure for rendering box drawing characters ourselvesDaniel Eklöf2021-01-01-0/+7
| | | | | | | | * ‘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.
* terminal: reaper callback: don’t close ptmx if already closedDaniel Eklöf2020-12-26-2/+5
|
* terminal: shutdown (or --hold) when the client process terminatesDaniel Eklöf2020-12-26-6/+19
| | | | | | | | | Shutdown the terminal when the client process terminates, not when the ptmx file descriptor is closed. This fixes an issue where the terminal remains running after the client process has terminated, if it spawned child processes that inherited the ptmx file descriptor.
* term: fix builds with debug logging enabledDaniel Eklöf2020-12-18-1/+1
| | | | DPI_AWARE_ON has been renamed to DPI_AWARE_YES
* fonts: size fonts using the scaling factor when output scaling is enabledDaniel Eklöf2020-12-17-16/+47
| | | | | | | | | | | | | | | | | | | This extends the new ‘dpi-aware’ option with a new default value, ‘auto’. When set to ‘auto’, fonts are sized using monitors’ DPI when output scaling is disabled. When output scaling is enabled, fonts are instead sized using the scaling factor. The reasoning here is that a user that has enabled output scaling is obviously *not* relying on DPI scaling. Output scaling can also be a way to compensate for different viewing distances, in which case we do *not* want to break that by using DPI scaling. Users can still force DPI-only font sizing by setting ‘dpi-aware=yes’, or disable it completely by setting ‘dpi-aware=no’.
* term: enabling application synchronized updates clear pending grid refreshDaniel Eklöf2020-12-14-9/+13
| | | | | | | | | | | 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-5/+20
| | | | | 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/+2
|
* codespell: currenly -> currently, second instanceDaniel Eklöf2020-12-07-1/+1
|
* codespell: currenly -> currentlyDaniel Eklöf2020-12-07-1/+1
|
* ime: add functions to enable/disable IME, simplify code that enables IMEDaniel Eklöf2020-12-07-6/+68
| | | | | | | | | | | | | | | | | 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-4/+14
|
* ime: render pre-edit textDaniel Eklöf2020-12-07-0/+9
| | | | | | | | | | | | | | 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/+1
| | | | | | | | | | 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: remove read-only properties copied from the configDaniel Eklöf2020-11-26-47/+32
| | | | Use the config directly instead.
* sixel: change default max size to 10000x10000Daniel Eklöf2020-11-23-0/+2
| | | | | It used to be the size of the window. This caused images to be cropped when the application emitting them didn’t change the max size.
* pgo: feed VT data through fdm_ptmx(), not vt_from_slave()Daniel Eklöf2020-11-22-1/+3
| | | | | | | | | | | | | | | | | fdm_ptmx(), the FDM callback handler for ptmx data, is just as much in the hot path as vt_from_slave(). It is also slightly more complicated than a read() followed by a call to vt_from_slave(). As a result, some benchmarks performed significantly worse in a partial PGO build than in a full PGO build, since fdm_ptmx() wasn’t PGO:d. To be able to feed data through fdm_ptmx(), we need to set up the delayed rendering timer FDs, configure the timeout values, and provide a readable FD it can read the VT data from. The latter is done with a memory FD. This ensures *all* VT data is loaded into memory before we feed it to the parser.
* terminal: use 96, not 75, for DPI when being DPI unawareDaniel Eklöf2020-11-19-4/+4
|
* config: add ‘dpi-aware’ option, defaulting to enabledDaniel Eklöf2020-11-19-11/+61
| | | | | | | | | | 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/+1
| | | | | This adds a num_lock_modifier state to the terminal, and hooks up “CSI?1035h/l” to toggle it.
* tiocswinsz: fix compilation error on e.g. ppc64Daniel Eklöf2020-10-29-1/+1
| | | | | | | | | | | | | | | | | | | | | | | On some platforms, TIOCSWINSZ has a very large value, > 0x80000000. On some platforms, the `request` argument to `ioctl(3)` is an `int`. For platforms where both of the above is true, gcc will warn (and error out if compiled with `-Werror`) on: ioctl(fd, TIOCSWINSZ, ...) To silence this warning, we need to cast `TIOCSWINSZ` to an integer. However, doing this on platforms where `request` is an `unsigned long` will result in `TIOCSWINSZ` being sign-extended (and thus we end up with an invalid value). It seems that casting to `unsigned int` works in both cases; it silences the long -> int conversion warning, while also preserving the correct value in all cases.
* config: add font-bold, font-italic and font-bold-italic optionsDaniel Eklöf2020-10-20-50/+102
| | | | | | | | | | 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.
* term: reset: enable/disable cursor blink depending on user configurationDaniel Eklöf2020-10-13-1/+4
|
* term: reset: kill blink timerDaniel Eklöf2020-10-13-0/+1
|
* term: remove unneeded blink.active fieldDaniel Eklöf2020-10-13-3/+0
| | | | We now use the timer FD instead; if it is -1, blinking is not active.
* term: instantiate cursor blink timer on-demandDaniel Eklöf2020-10-13-9/+21
|
* term: create/destroy blink timer on-demandDaniel Eklöf2020-10-13-15/+21
| | | | | | | | Blinking text is uncommon. It doesn’t make that much sense to keep a timer opened (but unarmed) at all times. This patch makes it so the timer is instantiated on-demand, and destroyed again when it no longer is needed.
* term: subpixel changed: fix build with LOG_ENABLE_DBG=1Daniel Eklöf2020-10-13-6/+6
|
* Merge branch 'scroll-up-down-while-selecting' into masterDaniel Eklöf2020-10-12-0/+6
|\ | | | | | | Closes #149
| * selection: auto-scroll: selection keeps scrolling while mouse is outside gridDaniel Eklöf2020-10-11-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+2
|/
* term: update sixel rows/cols *after* cell dimension change, *before* resizeDaniel Eklöf2020-10-09-39/+27
| | | | | This fixes an issue where we resized+reflowed with bad rows/cols values in the sixels.
* term: re-calculate sixel images’ rows/cols values when cell size changesDaniel Eklöf2020-10-09-0/+14
|
* bell: optionally render margins in red when receiving BELDaniel Eklöf2020-10-08-0/+17
| | | | | | | | | | | 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: cursor-left: unlikely -> likely for reverse-wrapDaniel Eklöf2020-10-06-1/+1
| | | | | Since reverse wrap-around is enabled by default, we’re *likely* to take this branch.
* term: enable reverse wrap-around by defaultDaniel Eklöf2020-10-06-0/+2
| | | | | Since we’re now doing reverse auto-wrapping by default, we add ‘bw’ (‘auto_left_margin’)to terminfo.
* term: cursor-left: don’t do reverse-wrapping unless auto-margins are enabledDaniel Eklöf2020-10-03-1/+1
| | | | This matches XTerm’s behavior.
* term: cursor-left: reverse-wrap when cursor is at the left marginDaniel Eklöf2020-10-02-3/+38
| | | | Assuming the private mode ‘reverse-wrap’ has been enabled.