aboutsummaryrefslogtreecommitdiff
path: root/terminal.h (follow)
Commit message (Collapse)AuthorAgeLines
...
* 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.
* unicode-combining: pack structDaniel Eklöf2020-05-01-1/+1
|
* unicode-combine: leave a note saying we might need more than 2 combining charsDaniel Eklöf2020-05-01-1/+1
|
* unicode-combining: completely remove unicode combining characters when feature is disabledDaniel Eklöf2020-05-01-0/+5
|
* term: combining characters: reduce max number of combining charactersDaniel Eklöf2020-05-01-1/+1
|
* render: render combining charactersDaniel Eklöf2020-05-01-1/+1
| | | | | | | | | | | | | | | | | This is basically just a loop that renders additional glyphs on top off the base glyph. Since we now need access to the row struct, for the combining characters, the function prototype for 'render_cell()' has changed. When rendering the combining characters we also need to deal with broken fonts; some fonts use positive offsets (as if the combining character was a regular character), while others use a negative offset (to be used as if you had already advanced the pen position). We handle both - a positive offset is rendered just like a regular glyph. When we see a negative offset we simply add the width of a cell first.
* grid: add per-cell combining charactersDaniel Eklöf2020-05-01-0/+6
| | | | | | | | | | The data is *not* added to the cell struct, since that one is too performance critical. Instead, the data is added as a separate array in the row struct. This allows our performance critical code paths that e.g. clear cells to perform as before.
* term: don't enable ptmx FDM callback until Wayland window has been configuredDaniel Eklöf2020-04-30-0/+1
| | | | | | | | | | | | | The way things works right now, we cannot enable the ptmx FDM callback right away. We need to wait for the Wayland window to have been configured. Before the window is configured, we don't have a size, and no grid. Thus, if we try to process ptmx data we'll crash since we have no where to write it to. So, registering the ptmx fd with the FDM is now delayed until we've received the first 'configure' event from Wayland.
* term: remove unneeded utf8.left memberDaniel Eklöf2020-04-27-1/+0
|
* damage: remove 'scroll' sub structDaniel Eklöf2020-04-26-5/+2
| | | | There is no other types of damage but scroll damage.
* fcft: adjust to fcft-2.0 API changesDaniel Eklöf2020-04-21-2/+2
| | | | | | | * font_*() -> fcft_*() * struct font -> struct fcft_font * struct glyph -> struct fcft_glyph * enum subpixel_order -> enum fcft_subpixel
* render: use output's subpixel mode when rasterizing glyphsDaniel Eklöf2020-04-20-0/+3
|
* grid: move 'cursor' state from terminal to gridDaniel Eklöf2020-04-16-3/+3
| | | | | This way, the 'normal' and 'alt' grids have their own cursor state, and we don't need to switch between them.
* Merge branch 'master' into scroll-damage-performanceDaniel Eklöf2020-03-27-2/+1
|\
| * client: add --maximized and --fullscreenDaniel Eklöf2020-03-27-2/+1
| | | | | | | | | | | | | | | | | | We now create a copy of the config for each client, and updates it with the values passed from the client. Since we're not actually cloning it (and e.g. strdup() all strings etc) we can't call conf_destroy() to free it, but need to free just the strings we've replaced.
* | render: pace title updatesDaniel Eklöf2020-03-25-0/+2
|/ | | | Synchronize window title updates with window rendering.
* term: ptmx: don't enqueue extra frame render when app sync updates have been changedDaniel Eklöf2020-03-16-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Track whether app-sync updates were enabled or disabled while handling the current chunk of PTMX data. This fixes and issue where we called render_refresh() unnecessarily under (at least) the following conditions: * Application sent "BSU <data> ESU" in the *same* chunk. In this case we never saw that app sync was enabled and triggered delayed rendering as usual. * Application sent ESU. While we had noticed app sync updates being enabled in earlier PTMX reads, when it was disabled *in the current* PTMX read, we treated it as if it had not been enabled at all. This caused us to trigger delayed rendering. Now we call render_refresh() directly from ESU, and detect the "flip off" case in PTMX read and avoid triggering a delayed rendering. The end result of all this is that each key press (for e.g. scrolling in a pager application) went from two frames being rendered, to a single frame.
* alt-screen: use a custom 'saved' cursor when switching to alt screenDaniel Eklöf2020-03-16-1/+1
| | | | | | | | | | | | | This fixes an issue where we failed to restore the cursor correctly when exiting from the alternate screen, if the client had sent escapes to save the cursor position while inside the alternate screen. This was because we used the *same* storage for saving the cursor position through escapes, as for saving it when entering the alternate screen. Fix by using a custom variable dedicated to normal <--> alt screen switching.
* sixel: improve handling of images when reflowing the gridsDaniel Eklöf2020-03-13-12/+10
| | | | | | | | | | | Update the sixels' 'row' attribute when re-flowing a grid, to ensure it is rendered at the correct place. This should work in most cases, but will break when the cell size has changed (e.g. font size increase/decrease, or a DPI change). This patch also moves the sixel image list from the terminal struct into the grid struct. The sixels are per-grid after all.
* render: never render CSD and/or search box "immediately"Daniel Eklöf2020-03-06-2/+14
| | | | | | | | | | Handle the CSDs and the search box the same way we handle the main grid; when we need to redraw them, call render_refresh_{csd,search}(). This sets a flag that is checked after each FDM iteration. All actual rendering is done here. This also ties the commits of the Wayland sub-surfaces to the commit of the main surface.
* csd: initial implementation of minimize/maximize/close buttonsDaniel Eklöf2020-03-02-0/+3
|
* render: remember, and use, last unmaximized sizeDaniel Eklöf2020-02-26-0/+2
| | | | | | | | When the compositor wants us to decide the size (it sends a configure event with width/height == 0), then use the last unmaximized size, if there is one. If there isn't one, use the size from the user configuration.
* term: add term_surface_kind(), and track currently active surfaceDaniel Eklöf2020-02-24-0/+15
| | | | | | This is needed to handle pointer motion and button events correctly, since mouse actions in e.g. CSD surfaces are very different from mouse actions in the main window.
* term: resize: pre-calculate right/bottom marginsDaniel Eklöf2020-02-24-2/+6
|
* sixel: track which grid image was created onDaniel Eklöf2020-02-22-0/+1
|
* sixel: application configurable image max width/heightDaniel Eklöf2020-02-22-1/+3
|
* sixel: application configurable palette size (color count)Daniel Eklöf2020-02-22-0/+3
| | | | | This implements the CSI escapes for retrieving and (re)setting the palette size.
* sixel: clean up state machineDaniel Eklöf2020-02-22-3/+8
| | | | | Use proper state names, and implement the state machine using switch statements.
* sixel: use a struct coord for current sixel positionDaniel Eklöf2020-02-22-11/+11
|
* sixel: rename state SIXEL_SIXEL -> SIXEL_GROUNDDaniel Eklöf2020-02-22-1/+1
|
* sixel: resize image buffer dynamicallyDaniel Eklöf2020-02-22-1/+6
|
* sixel: calculate image height in (cell) rowsDaniel Eklöf2020-02-21-0/+1
|
* sixel: wip: maintain a list of finished, and "active" sixel imagesDaniel Eklöf2020-02-21-2/+10
| | | | | | | | | | | | | | | | | | | In unhook, add the generated image to a list of finished sixel images, along with positioning and size information. When rendering, loop this list of images, and render the images (or parts of) that are visible. When scrolling, check if any part of the images cover the re-cycled lines, and if so, remove the *entire* image from the list. This means we have the following limitations: * The renderer always renders the whole (visible area of) the image(s). There are times when this isn't necessary - for example, when the image is scrolled inside the visible area. * It would be nice if we could crop the image when parts of it is scrolled out.
* sixel: initial supportDaniel Eklöf2020-02-21-0/+17
| | | | | | | | | This implements basic parsing of sixel data. Lots of limitations and temporary solutions as this is still work-in-progress: * Maximum image size hardcoded to 800x800 * No HLS color format support * Image is always rendered at 0x0 in the terminal
* slave: prefix argv[0] with a '-' when spawning a login-shellDaniel Eklöf2020-02-20-2/+2
|
* term: implement term_font_dpi_changed()Daniel Eklöf2020-02-15-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function reloads the font *if* the DPI has changed. To handle user run-time adjusted font sizes, we record the number of adjustments made. Then, when re-loading the font, we first load the font as specified in the configuration. Then, we re-apply the size adjustment using font_size_adjust(). Note that this means we end up loading the fonts twice; first using the default size (but with adjusted DPI), and then again with the adjusted size. This can probably be improved upon. The existing font code has been refactored to avoid code duplication. For example, term_init() now calls term_font_dpi_changed() to load the initial fonts, instead of directly instantiating them. Finally, the way we calculate the DPI to use has changed: instead of using the highest DPI of all available outputs, we use the highest DPI of the output's we're actually mapped on. If we're not mapped at all, we use the globally highest DPI. Doing it this way means we usually only have to load the fonts once. Otherwise, we'd end up using the default DPI of 96 when the terminal is first instantiated (since it's not mapped at that time). On a single monitor system, we'll use the globally highest DPI at first, before being mapped. Then when we get mapped, we re-load the fonts using the highest mapped DPI. But since they'll be the same, we can skip actually reloading the fonts.
* term: convert cell 'linefeed' attribute to a row 'linebreak' propertyDaniel Eklöf2020-02-14-2/+2
| | | | | | | | | | | | | | | | To do text reflow, we only need to know if a line has been explicitly linebreaked or not. If not, that means it wrapped, and that we should *not* insert a linebreak when reflowing text. When reflowing text, when reaching the end of a row in the old grid, only insert a linebreak in the new grid if the old row had been explicitly linebreaked. Furthermore, when reflowing text and wrapping a row in the new grid, mark the previous row as linebreaked if either the last cell was (the last column in the last row) empty, or the current cell (the first column in the new row) is empty. If both are non-empty, then we assume a linewrap.
* vt: tag cells that were form-feed:ed, to allow correct text reflowDaniel Eklöf2020-02-10-1/+3
| | | | | | | | | To handle text reflow correctly when a line has a printable character in the last column, but was still line breaked, we need to track the fact that the slave inserted a line break here. Otherwise, when the window width is increased, we'll end up pulling up the next line, when we really should have inserted a line break.