aboutsummaryrefslogtreecommitdiff
path: root/src/term
AgeCommit message (Collapse)Author
2018-03-13Fix selection in scrollbackChristian Duerr
There were a few issues with selection in scrollback that were mainly off-by-one errors. This aims at fixing these issues. This also fixes a bug that currently exists in master where the last cell is not selected when the mouse leaves the window to the right.
2018-03-13Merge branch #1095Christian Duerr
Because there was some overlap with branch #1095, these two PRs have been added together and the config has been restructured to make use of a `scrolling` section. The default faux scrolling amount has also been changed to `3` because this simplifies the code and falls in line with what most other terminal emulators do. There should be no additional test failures due to this.
2018-03-12Fix crash when selection leaves viewportChristian Duerr
There was an issue where alacritty tries to convert the lines in a selection to the on-screen lines even when the selection is not on the screen. This results in a crash. To prevent this from happening the selection now is not shown if it is off the screen. There currently still is a bug that when the selection is at the top of the screen but still half visible, it will not show the top line as selected but start in the second line. This bug should be resolved with https://github.com/jwilm/alacritty/pull/1171. This fixes #1148.
2018-03-08Fix 4+ line copyingJoe Wilm
2018-03-07Support selections with scrolling bufferJoe Wilm
Selections now *mostly* work. They move as the buffer scrolls, copying works as it should, and it looks like the different selection modes behave properly as well. The new Selection implementation uses buffer coordinates instead of screen coordinates. This leads to doing a transform from mouse input to update the selection, and back to screen coordinates when displaying the selection. Scrolling the selection is fast because the grid is already operating in buffer coordinates. There are several bugs to address: * A _partially_ visible selection will lead to a crash since the drawing routine converts selection coordinates to screen coordinates. The solution will be to clip the coordinates at draw time. * A selection scrolling off the buffer in either direction leads to indexing out-of-bounds. The solution again is to clip, but this needs to be done within Selection::rotate by passing a max limit. It may also need a return type to indicate that the selection is no longer visible and should be discarded. * A selection scrolling out of a logical scrolling region is not clipped. A temporary and robust workaround is to simply discard the selection in the case of scrolling in a region. wip selections fix issue with line selection selection mostly working need to support selection not being on the screen at draw time Fix selection_to_string Uncomment tests
2018-03-07Move selection into GridJoe Wilm
Supporting selections with scrollback has two major components: 1. Grid needs access to Selection so that it may update the scroll position as the terminal text changes. 2. Selection needs to be implemented in terms of buffer offsets -- NOT lines -- and be updated when Storage is rotated. This commit implements the first part.
2018-03-07Style cleanupJoe Wilm
2018-03-07Make number of scrollback lines configurableJoe Wilm
2018-03-07Scroll to bottom on character receivedJoe Wilm
2018-03-07Fir cursor not scrollingJoe Wilm
2018-03-07checkpoint: very basic scrolling worksJoe Wilm
Things that do not work - Limiting how far back in the buffer it's possible to scroll - Selections (need to transform to buffer offsets)
2018-03-07Use memcpy for resetting row contentsJoe Wilm
In addition to a marginal performance improvement, this simplifies some logic in the Term implementation since now the Grid fully handles row recycling.
2018-03-07Remove some unused methods and implsJoe Wilm
2018-03-07Eliminate ClearRegion traitJoe Wilm
2018-03-07Back Grid with VecDequeJoe Wilm
VecDeque offers improved performance beyond a plain Vec for common scrolling situations (full screen scroll). Additionally, VecDeque is necessary for performant scrollback since recycling old rows for a Vec would be expensive (push/pop front would shift entire vec).
2018-03-04Remove all instances of unwrap() from configChristian Duerr
Unwrapping inside the config file parsing can lead to some issues that prevent us from falling back to a default configuration file. One instance of that issue was mentioned in #1135. Now all instances of `unwrap()` have been removed and replaced with proper error handling. This will make the config more robust and prevents live reload from silently breaking while alacritty is running. This also fixes a few currently existing clippy issues. Clippy added an additonal lint which complains about `MyStruct { field: field }`. These issues have been fixed, except for some false-positives and issues in external macros which will probably be fixed with future updates (rust-lang-nursery/bitflags#149)
2018-02-28Update arraydeque dependencyAndy Lok
2018-01-18Implement `reset_state` of Term struct (#1035)Christian Duerr
Up to this point the `reset_state` method of the `Term` struct has been just a placeholder. This has been changed and all important state has been reset. The only state that has not been reset is stuff which is retrieved from the config and isn't stored as default on the `Term` struct either. From what I can tell these are all never changed though. This fixes jwilm/alacritty#1033. After doing some more testing trying to figure out how to fix that all glyphs are messed up after doing `cat /dev/urandom`, I was able to confirm that resetting `Term::cursor` fixes the glyphs and restores everything to normal. So this also fixes jwilm/alacritty#804.
2018-01-06Add clippy check to travisChristian Duerr
This commit adds clippy as a required step of the build process. To make this possible, all existing clippy issues have been resolved.
2018-01-06Improve ability of alacritty to deal with broken configChristian Duerr
Until now alacritty completely refuses to start when the config is broken in any way. This behavior has been changed so the worst-case is always that alacritty launches with the default configuration. When part of the config is broken, alacritty shouldn't instantly try to recover to the default config, but instead try to use defaults only for the parts of the config which are broken. This has also been implemented for most of the fields in the configuration. So it should be possible that parts are broken, but the rest is still used for the configuration. This fixes #954.
2018-01-05Prevent font_size_modifier from sinking too low (#994)Christian Duerr
This replaces the `font_size_modifier` stored on the `Term` struct with a `font_size` field. With this change it is not necessary anymore to calculate the new font size from a delta but the current font size is always stored directly on the `Term` struct. As a result of this it is now possible to increase the font size by more than 127 steps at runtime. It also limits the minimum font size to 1, so issues with the `font_size_modifier` dropping far below font size 1 are resolved with this change. This fixes #955.
2018-01-02Add support for set-clipboard. (#970)Geert Jansen
This allows e.g. tmux to set the clipboard via the OSC 52 escape code.
2017-12-24Refactor populate cursor, fix-wide-cursor (#762)Oliver Uvman
Cleanup cursor handling code and support wide cursors
2017-12-24Change mouse cursor on terminal mode change (#865)Dustin
Some terminals have functionality around changing the type of mouse cursor dynamically (arrow and text) based on which mode(s) the VTE is in. For example, gnome-terminal changes the cursor from text (default) to an arrow when opening programs that track mouse events (e.g. vim, emacs, tmux, htop, etc.). The programs all allow using the mouse interactively under some circumstances (like executing `set mouse=a` in vim). The programs that use an interactive mouse set the terminal mode to different values. Though they're not entirely the same terminal mode across programs, an emulator like vte (the library gnome-terminal implements), changes the mouse cursor if the mouse mode is one of the following: - 1000: Mouse Click Tracking - 1001: Mouse Highlight Tracking - 1002: Mouse Cell Motion Tracking - 1003: Mouse All Motion Tracking - 1004: Mouse Focus Tracking See https://github.com/GNOME/vte/blob/6acfa59dfcceef65c1f7e3570db37ab245f049c4/src/vteseq.cc#L708 for more information. This commit adds functionality that changes the winit/glutin `MouseCursor` when a mouse-listening mode of 1000-1004 is set. It behaves similarly to when the window title changes.
2017-12-24Adding dynamic_title property to configuration (#819)Wesley Gahr
This logic is applied in Term's ansi::Handler implementation to avoid unnecessary allocations.
2017-12-24Add box cursor to unfocused underline and beamChristian Duerr
Because some people have requested this change, the beam and underline cursors now also transform into an empty box when the terminal loses focus. Like this there is one unique symbol to indicate that a terminal is not currently focused.
2017-12-24Add custom box cursor for unfocused windowChristian Duerr
2017-12-24Add custom beam cursorChristian Duerr
In issue jwilm/asacritty#31 a few people complained about Beam cursor being weird with their fonts, so to make all cursors uniform in alacritty, a custom cursor has been added for the Beam too. The beam cursor's height is always the full height of the monospace font glyph bounding box. The width depends on the font size. It is calculated using the width of the cell and dividing it by two. The block is always aligned at the far-left of the cell. The implementation is identical to the one of the underline cursor, but it has been refactored so the glyphs are created in `lib.rs`, which can be used by darwin/macos to implement these features too. A small bug in the underline cursor has also been fixed, until now the width was just using the width of the unicode character. Now it should be using the full width of the monospace glyph bounding box with every font. Here are some screenshots for the Beam cursor: ![Small](https://u.teknik.io/v1QH3.png) ![Normal](https://u.teknik.io/RTlp2.png) ![Big](https://u.teknik.io/DLu2M.png) ![Huge](https://u.teknik.io/pSAFX.png)
2017-12-24Update comment to reference proper characterChristian Duerr
The unicode character comment has been updated to correctly reference the character instead of commenting on the variable that might be that character.
2017-12-24Revert to old system for macosChristian Duerr
Because rendering with macos works differently, the old underline cursor is used for that. The cursor symbol has also been setup as a constant in the font project.
2017-12-24Add custom underline cursorChristian Duerr
As mentioned in jwilm/alacritty#931, it can be troublesome if a font has an underline symbol outside of the glyph's bounding box. This can lead to the underline disappearing at the bottom of the terminal. As a solution a symbol from the private use area was used as the character code for the underline symbol. Whenever this symbol is encountered, instead of rendering it, a custom block is rendered. In this implementation the block has the full character as width and sits flush with the bottom of the glyph's bounding box. The height is half the distance between the baseline and the bottom of the bounding box.
2017-12-23Update bitflags to v1Chet Gurevitch
2017-12-22Assure that newlines are in selections (#777)Dustin
When a selection was made, the last line of the selection did not include a new line character when the line ending was selected. This would occur if only one line was selected; if multiple lines were selected, only the final line did not include a newline. This commit updates the `string_from_selection` function to attempt to append a newline character in all places where they are suitable. Because of the simplification of newline insertion, several trait implementations were removed.
2017-12-22Style nitsJoe Wilm
2017-12-22Implement faux scrollingChristian Duerr
This patch implements faux scrolling inside the alternate screen buffer. Whenever the user scrolls up or down while the alternate screen buffer is active, instead of actual scrolling three up/down arrow keys are inserted.
2017-12-03Add cursor style option (#928)Christian Duerr
The default cursor can now be configured through the cursor_style field of the config. Valid options include Block, Underline, and Beam. The default can be restored by sending \e[0q as in VTE terminals. Live config reloading is supported for this parameter.
2017-12-03clippy: do and don't pass some things by reference as suggested ↵Matthias Krüger
(needless_pass_by_value, needless_borrow).
2017-11-11Match LF behavior outside scroll region with urxvtJoe Wilm
Outside of a scroll region, linefeed will still advances the line until reaching the bottom row in other terminals. Alacritty now matches that.
2017-11-11Correct linefeed handling when scroll region set (#855)Yan
Linefeeds should only move the cursor down if it's before the end of the scroll region. The "out of bounds" panic was triggered by linefeeds going off the bottom of the screen when the scroll region end was above the cursor. Note: https://vt100.net/docs/vt102-ug/chapter5.html "Characters added outside the scrolling region do not cause the screen to scroll."
2017-10-30fix some typos in commentsMartin Lindhe
2017-10-21Set urgent WM flag on bell on X11 systems (#812)Barret Rennie
Sets the urgent WM flag when bell is emitted on X11 systems. Additionally, the flag is cleared on focus because not all WMs clear it automatically.
2017-10-21Fix solid background color opacity (#847)Joe Wilm
Since landing the patch adding transparency support to Alacritty, there's been an issue where othewise solid background cells were also being rendered partially transparent. Now, all filled background cells are rendered fully opaque. Some logic was added to support discarding filled backgrounds which had the same color as the default background. This means that, if the default background is #000 and a cell has that background, it will never be rendered opaque. This may not be correct. Note that many truecolor vim color schemes print spaces for default colored background cells. Performance can be dramatically improved by using ctermbg=NONE guibg=NONE to skip rendering those cells.
2017-10-14Implement user actions for font resize (#625)Dan Aloni
Adds support for font resizing at run-time. Three new actions are introduced: * IncreaseFontSize - Increases current font size by 1.0 * DecreaseFontSize - Decreases current font size by 1.0 * ResetFontSize - Resets font size to that specified in the configuration. The stock config files have example configuration for each which should match gnome-terminal. For convenience, the config entries are: - { key: Key0, mods: Control, action: ResetFontSize } - { key: Equals, mods: Control, action: IncreaseFontSize } - { key: Subtract, mods: Control, action: DecreaseFontSize }
2017-10-14Fix resize behaviorJoe Wilm
Should prevent the messed up background colors that appear in some situations (especially on tiling WMs).
2017-09-27Use clippy = "*", update, and fix some warnings (#796)Aaron Hill
Because there are so many clippy warnings in the current codebase, this commit removes '#![cfg_attr(feature = "clippy", deny(clippy))]', to make it easier to fix warnings incrementally.
2017-09-05Update most remaining depsJonathan Schleußer
2017-08-29Fix reloading colors from config (#756)Tuomas Siipola
2017-08-22Fix newline + scroll region bug (#747)Joe Wilm
When a scroll region is active with the cursor below the bottom of the region, newlines should not cause the region to scroll. A ref test was added for this situation to prevent regressions. Thanks @hiciu for reporting and @nicm for the test case. Resolves #745.
2017-08-11Fix smcup/rmcup toggle bugJoe Wilm
Resolves #634.
2017-08-11Rename some variables for clarityJoe Wilm