aboutsummaryrefslogtreecommitdiff
path: root/src/term
Commit message (Collapse)AuthorAge
* Split alacritty into a separate cratesTheodore Dubois2019-04-28
| | | | | The crate containing the entry point is called alacritty, and the crate containing everything else is called alacritty_terminal.
* Fix position of zero-width over double-width charactersChristian Duerr2019-04-25
|
* Fix cursor disappearingChristian Duerr2019-04-25
| | | | | | | | | | | | | | The cfc20d4f34dca535654cc32df18e785296af4cc5 commit introduced a regression which would cause the cursor to disappear after the glyph cache has been filled. Since the cursor was not cached on the glyph cache, the cursor would quickly fill up the OpenGL texture with lots of cursor textures and then things would break after the atlas was filled completely. This adds a separate cursor cache which is keyed by the cursor style that will persist the texture without flooding the atlas. This fixes #2355.
* Show same fg/bg text when inversedChristian Duerr2019-04-25
| | | | | | | | | | | If a cell has a matching foreground and background and is inversed through the escape or selection, it will now fall back to the default background on top of the default foreground. This makes it possible to show invisible text like this by selecting it. Hidden text is unaffected by this change. This fixes #2315.
* Fix hidden cursor inverting cell colorsChristian Duerr2019-04-22
| | | | | | | | | | Since the block cursor inverts the background and foreground colors of a cell, the hidden cursor has done the same thing without rendering a cursor since it was using the block cursor shape. A new `Hidden` cursor style has been introduced for explicitly handling the invisible cursor differently. This fixes #2342.
* Fix cursor colorsChristian Duerr2019-04-20
| | | | | | | | | | This fixes a recent regression in cfc20d4f34dca535654cc32df18e785296af4cc5 which broke cursor colors when specified in the `colors.cursor` field in the config. It also removes a lot of unneeded code from the font crate related to the cursor rendering. This fixes #2338.
* Fix cursor dimension style issuesChristian Duerr2019-04-19
|
* Fix cursor dimensions with font offsetChristian Duerr2019-04-19
| | | | | | | | | | | | | | Previously cursor dimensions were not calculated correctly when a font offset was specified, since the font offset was completely ignored. This has been fixed by moving all the cursor logic from the font into the Alacritty crate, applying the config's offsets before rasterizing the cursors. This has also fixed an issue with some cursors not being rendered as double-width correctly when over double-width glyphs. This fixes #2209.
* Fix update_lines performance issuesChristian Duerr2019-04-19
| | | | | | | | | | | This resolves performance issues with the `update_lines` method that were caused by excessive updates without underlines or strikeout present. This also resolves a bug that was causing the underline and strikeout to extend beyond the end of line in some rare cases. This fixes #114.
* Remove outdated comment line.Nathan Lilienthal2019-04-18
|
* Remove redundant closures and importsMatthias Krüger2019-04-11
|
* Reset scrolling region when receiving RIS escapeDaniel Eklöf2019-04-08
|
* Add rustfmt style guideChristian Duerr2019-03-30
|
* Rework URL highlightingChristian Duerr2019-03-30
| | | | | | | | | | | | | | | | | | | | | | | | This completely reworks URL highlighting to fix two issues which were caused by the original approach. The primary issues that were not straight-forward to resolve with the previous implementation were about handling the URL highlighted content moving while the highlight is active. This lead to issues with highlighting with scrolling and when the display offset was not 0. The new approach sticks closely to prior art done for the selection, where the selection is tracked on the grid and updated whenever the buffer is rotated. The truncation of URLs was incorrectly assuming input to be just a single codepoint wide to truncate the end of URLs with unmatching closing parenthesis. This is now handled properly using Rust's built-in Unicode support. This fixes #2231. This fixes #2225.
* Fix URL highlight crashChristian Duerr2019-03-24
| | | | | | | | | | | | | | | | | | The URL highlight stores the state of the last URL highlight with the position of the URL start position. However when resizing, it's possible that the indices of this point change which will cause a crash if the old positions are not within the grid anymore. This has been resolved by resetting the URL highlight state whenever the terminal is resized. The original PR incorrectly required the shift modifier to be required when the user was in the alternate screen buffer. However the correct behavior is to require it when the mouse mode is enabled. This has been resolved and URLs are now highlighted in the alt screen even if no shift modifier is pressed. This fixes #2194.
* Fix URL parsing with double-width charactersChristian Duerr2019-03-23
| | | | | | | | | | | | | Since double-width characters are followed by an empty cell containing only the `WIDE_CELL_SPACER` flag, the URL parser would stop once encountering the cell after a double-width character. By skipping cells that contain the `WIDE_CELL_SPACER` flag and incrementing the URL length by unicode width of the character instead of cell count, this can be resolved for both URL launching and URL highlighting. Fixes #2158.
* Fix URLs getting incorrectly extended to next lineChristian Duerr2019-03-19
| | | | | | | | | | | | If a URL ends right at the end of the terminal, it would sometimes incorrectly include the characters from the following line when launching the URL. Similar to the semantic search function, the URL parsing iterator will now stop if it encounters a cell at the end of the line which does not contain the `WRAPLINE` flag. This fixes #1906.
* Add URL hover highlightingChristian Duerr2019-03-19
| | | | | | | | | | | | | | | This changes the cursor whenever it moves to a cell which contains part of a URL. When a URL is hovered over, all characters that are recognized as part of the URL will be underlined and the mouse cursor shape will be changed. After the cursor leaves the URL, the previous hover state is restored. This also changes the behavior when clicking an illegal character right in front of a URL. Previously this would still launch the URL, but strip the illegal character. Now these clicks are ignored to make sure there's no mismatch between underline and legal URL click positions
* Remove InclusiveRange codeChristian Duerr2019-03-17
| | | | This removes all inclusive range code since it has been recently stabilized in the standard lib.
* Add text reflowChristian Duerr2019-03-13
| | | | | | | | | | | | | | | | | | | | Alacritty will now automatically reflow lines and shrink them when they would usually exceed the new width of the terminal instead of truncation. If a line had to be truncated, it will also be reflown into the previous line after growing the terminal width. The reflow behavior when not at the bottom of the history is similar to that of VTE and aims to keep the viewport stationary whenever possible. Opposed to VTE, reflow will also be performed in the alternate screen buffer. There will be bugs when resizing the terminal emulator to a size smaller than the prompt, though these issues were present in all terminal emulators with reflow support. This fixes #591.
* Add config option to change selection colorKirill Chibisov2019-03-12
|
* Fix signal handling on Unix systemsRachel K2019-03-12
| | | | | | | | | | | | | | | | | | | | This removes the the signal handling machinery in tty::unix, and replaces it with functionality from signal-hook, which should be more robust. Signals caught by signal-hook wake up the existing I/O event loop, which then delegates back to the PTY to handle them. In particular, this allows `SIGCHLD` (i.e. child process exits) to shut down the terminal promptly, instead of sometimes leaving the window lingering. Fixes #915. Fixes #1276. Fixes #1313. As a side effect, this fixes a very rare bug on Linux, where a `read` from the PTY on the master side would sometimes "fail" with `EIO` if the child closed the client side at a particular moment. This was subject to a race condition, and was very difficult to trigger in practice.
* Add dynamic title support for WindowDavid Hewitt2019-03-07
|
* Fix selection starting inside paddingLado Tonia2019-03-04
| | | This fixes #2109.
* Fix alt screen bugsChristian Duerr2019-03-02
| | | | | | | | | | | | | | | This fixes two bugs with the alternate screen buffer. When resetting while in the alt screen, Alacritty would not swap out the grids leading to scrollback getting disabled. By swapping out the grids again when resetting in the alternate screen buffer, scrollback is now unaffected from a reset. There was another issue with the cursor jumping around when leaving the alt screen even though it was not active, this was fixed by skipping all alt screen swap routines unless the current state matches the expected state. This fixes #2145.
* Remove selections when clearing screen partiallyChristian Duerr2019-02-08
| | | | | | | | | | | | | | Automatically remove all selections when part of the screen is cleared. This fixes issues in applications like `less -S` where a selection would stay around after scrolling horizontally. XTerm and URxvt both choose to always remove the selection, even if it's outside of the cleared area, however VTE only clears the selection if any part of it is inside the cleared area. To keep things simple, Alacritty has adopted the behavior of XTerm and URxvt to always clear selections. This fixes #1644.
* Dynamically resize terminal for errors/warningsChristian Duerr2019-02-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The warning and error messages now don't overwrite other terminal content anymore but instead resize the terminal to make sure that text can always be read. Instead of just showing that there is a new error and pointing to the log, errors will now be displayed fully in multiple lines of text, assuming that there is enough space left in the terminal. Explicit mouse click handling has also been added to the message bar, which made it possible to add a simple `close` button in the form of `[X]`. Alacritty's log file location is now stored in the `$ALACRITTY_LOG` environment variable which the shell inherits automatically. Previously there were some issues with the log file only being deleted when certain methods for closing Alacritty were used (like typing `exit`). This has been reworked and now Ctrl+D, exit and signals should all work properly. Before the config is reloaded, all current messages are now dropped. This should help with multiple terminals all getting clogged up at the same time when the config is broken. When one message is removed, all other duplicate messages are automatically removed too.
* Fix unclickable URLs with scrolled viewportChristian Duerr2019-02-07
| | | | | | | | | | | Since scrolling the terminal moves around the underlying data structure of the terminal, the URL selection would search for the URL at the position where the click would have been without any scrolling. By adding the viewport offset to the click position, the URL clicking now searches at the correct location. This fixes https://github.com/jwilm/alacritty/issues/2076.
* Fix off-by-one error in erase_charsAlexander Bulimov2019-01-21
|
* Make all configuration fields optionalChristian Duerr2019-01-17
| | | | | | | | | | | | | | | | | | All configuration fields now have fallback values which will be used if the field is not present. This includes mouse, key bindings and platform specific differences. The mouse and key bindings are now filled by default, if the user rebinds a default mapping, it will be overwritten. To unbind a default binding, it can be mapped to `chars: ""`. Since all platform differences can now be correctly handled by the `src/config/mod.rs` code, it's no longer necessary to maintain separate configuration files, so the `alacritty_macos.yml` and `alacritty_windows.yml` have been deleted. Fixes #40. Fixes #1923.
* Fix tabs overwriting cells during movementChristian Duerr2019-01-13
| | | | | | | | | | | When compiling ncurses with the `--enable-hard-tabs` option, it will make use of tabs to speed up cursor movement. These tabs can be set at positions which will overwrite existing characters. Since these are only for movement and not supposed to write anything to the terminal, it is now checked that a cell does not contain any character before writing a tab to it. This fixes #1933.
* Normalize Log Message StringsNathan Lilienthal2019-01-07
| | | | | | The general style for errors, warnings and info messages is to start with a capitalized letter and end without a period. The main exception is when dealing with nouns that are clearer with special case handling, e.g. "macOS failed to work" or "ioctl is borked".
* Improve URL detection with special charactersChristian Duerr2019-01-05
| | | | | | | | | | | | | Various special characters and character combinations were not handled correctly with URL detection. All these instances have been resolved and covered by various tests to prevent future regressions. Notable fixes include single quotes working more properly now (like `'https://example.org'`) and IPv6 URL support. Since URL detection is now more than just a few lines of code and it's mostly unrelated to the `Term`, it has also been extracted into the `src/url.rs` file together with all URL-related tests.
* Limit number of URL schemesChristian Duerr2019-01-05
| | | | | | | | | | | | | | | | | This limits the number of allowed schemes for the URL launcher, to reduce the number of false-positives. The accepted URL schemes are now: - http - https - mailto - news - file - git - ssh - ftp This fixes #1727.
* Fix removal of trailing URL charactersChristian Duerr2019-01-05
| | | | | | | | | | | | | | | Some characters were not correctly stripped from the end of URLs with the URL launching feature. The list of URL separator characters has been extended to include '<', '>', '"', ' ', '{', '}', '|', '\\', '^' and '`', following the URL specification defined here: https://tools.ietf.org/html/rfc3987#page-13 Additionally, a list of characters which are always stripped from the end of URLs has been setup to contain '.', ',', ';', ':', '?', '!', and '/'. This fixes #1753.
* Add proper underline and strikeout supportChristian Duerr2018-12-22
| | | | | This makes use of the new rectangle rendering methods used to display the colored visual bell to add proper underline and strikeout support to Alacritty.
* Fixing tabs in copy-pasteSteve Blundy2018-12-15
| | | | | | | | | | This resolves issues with copy-pasting tabs by including them in the pasted string. Selection of tabs is still inconsistent with what might be expected based on other terminal emulators, however the behavior hasn't regressed. This fixes https://github.com/jwilm/alacritty/issues/219.
* Upgrade to Rust 2018Joe Wilm2018-12-10
| | | | | This resolves a lot of NLL issues, however full NLL will be necessary to handle a couple of remaining issues.
* Fix rendering of zero-width charactersChristian Duerr2018-12-09
| | | | | | | | | | | | Instead of rendering zero-width characters as full characters, they are now properly rendered without advancing the cursor. Because of performance limitations, this implementation only supports up to 5 zero-width characters per cell. However, as a result of this limitation there should not be any performance impact. This fixes #1317, fixes #696 and closes #1318.
* Fix for an underflow on some type conversions (#1715)Zac Pullar-Strecker2018-11-25
|
* Add keybinding action for clearing warns/errorsChristian Duerr2018-11-19
| | | | | | | | | | | | | Since running `clear` inside of tmux doesn't actually clear any part of the screen, but just resets the scrolling region, the warning and error notices can't be removed without quitting tmux or Alacritty. As a solution, a new action `ClearLogNotice` has been added which has been bound to Ctrl+L by default. As a result, Ctrl+L can be used inside of tmux to remove the messages, even though tmux doesn't clear the screen. This fixes #1811.
* Display errors and warningsChristian Duerr2018-11-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To make sure that all error and information reporting to the user is unified, all instances of `print!`, `eprint!`, `println!` and `eprintln!` have been removed and replaced by logging. When `RUST_LOG` is not specified, the default Alacritty logger now also prints to both the stderr and a log file. The log file is only created when a message is written to it and its name is printed to stdout the first time it is used. Whenever a warning or an error has been written to the log file/stderr, a message is now displayed in Alacritty which points to the log file where the full error is documented. The message is cleared whenever the screen is cleared using either the `clear` command or the `Ctrl+L` key binding. To make sure that log files created by root don't prevent normal users from interacting with them, the Alacritty log file is `/tmp/Alacritty-$PID.log`. Since it's still possible that the log file can't be created, the UI error/warning message now informs the user if the message was only written to stderr. The reason why it couldn't be created is then printed to stderr. To make sure the deletion of the log file at runtime doesn't create any issues, the file is re-created if a write is attempted without the file being present. To help with debugging Alacritty issues, a timestamp and the error level are printed in all log messages. All log messages now follow this format: [YYYY-MM-DD HH:MM] [LEVEL] Message Since it's not unusual to spawn a lot of different terminal emulators without restarting, Alacritty can create a ton of different log files. To combat this problem, logfiles are removed by default after Alacritty has been closed. If the user wants to persist the log of a single session, the `--persistent_logging` option can be used. For persisting all log files, the `persistent_logging` option can be set in the configuration file
* Upgrade Glutin to v0.19.0Matt Keeler2018-11-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some changes include: • Use the with_hardware_acceleration function on the ContextBuilder to not require the discrete GPU • Remove the LMenu and RMenu virtual key codes (winit 0.16.0 removed these because Windows now generates LAlt and RAlt instead • Replace set_cursor_state with hide_cursor (winit 0.16.0 removed the set_cursor_state function) • Replace GlWindow::hidpi_factor with GlWindow::get_hidpi_factor and change to expecting an f64 • Use the glutin/winit dpi size and position types where possible Glutin's dpi change event has been implemented. All size events now return logical sizes. As a result of that, the logical sizes are translated in the `display::handle_rezize` method so DPI scaling works correctly. When the DPI is changed, the glyph cache is updated to make use of the correct font size again. Moving a window to a different screen which is a different DPI caused a racing condition where the logical size of the event was sent to the `handle_resize` method in `src/display.rs`, however if there was a DPI change event before `handle_resize` is able to process this message, it would incorrectly use the new DPI to scale the resize event. To solve this issue instead of sending the logical size to the `handle_resize` method and then converting it to a physical size in there, the `LogicalSize` of the resize event is transformed into a `PhysicalSize` as soon as it's received. This fixes potential racing conditions since all events are processed in order. The padding has been changed so it's also scaled by DPR. The `scale_with_dpi` config option has been removed. If it's not present a warning will be emitted. The `winit` dependency on Windows has been removed. All interactions with winit in Alacritty are handled through glutin.
* Rework cursor configurationChristian Duerr2018-11-01
| | | | | | | | | | | | | | | | | | | | | | | | | | There are a couple of cursor-related options in the Alacritty config file now, however they aren't grouped together in any way. To resolve this a new `cursor` field has been added where all cursor configuration options (besides colors) have been moved. The `custom_cursor_colors` option has also been removed, since it's not necessary anymore. Simply making the `colors.cursor.*` fields optional, allows overriding the cursor colors whenever one of them is present. Like that the user doesn't have to think about a relation between two separate configuration options. This PR initially put the `hide_cursor_when_typing` variable under `cursor.hide_when_typing`. However this field is completely unrelated to the cursor, but instead relates to the mouse cursor. Since the word `cursor` is already used for the active cell in the grid of a terminal emulator, all occurences of the word `cursor` when talking about the mouse have been replaced with the word `mouse`. The configuration option has also been moved to `mouse.hide_when_typing`, to make it clear what this option is changing. This fixes #1080.
* Add option to open URLs on clickChristian Duerr2018-10-22
| | | | | | | | | | | | | | | | | | | | | | This adds the option to automatically launch URLs with a specified program when clicking on them. The config option `mouse.url_launcher` has been added to specify which program should be used to open the URL. The URL is always passed as the last parameter to the specified command. It is not always desired for URLs to open automatically when clicking on them. To resolve this a new `modifiers` field has been introduced to the config, which allows specifying which keyboard modifiers need to be held down to launch URLs in the specified launcher. Some tests have been added to make sure that the edge-cases of the URL parsing are protected against future regressions. To make testing easier the parsing method has been moved into the `SemanticSearch` trait. The name of the trait has also been changed to just `Search` and it has been moved to `src/term/mod.rs` to fit the additional functionality. This fixes #113.
* Fix rotation of selection below 0Christian Duerr2018-10-20
| | | | | | | | | | | | | | Whenever the viewport is scrolled, the selection is rotated to make sure that it moves with the viewport. However this did not correctly handle the underflow that happens when the selection goes below 0. This resolves that problem for the selection by moving the internal line representation to an isize, thus correctly keeping track of the selection start/end points even when they have a negative index. Once the selection is converted to a span, the lines are clamped to the visible region. This fixes #1640 and fixes #1643.
* fix erroneous indexed_color resultsRobert Martin Winterstein2018-10-07
|
* Drop terminal lock before renderingtrimental2018-09-30
| | | | | | | | The terminal lock is now dropped before rendering by storing all grid cells before clearing the screen. This frees the terminal to do other things since the lock is now free, which lead to a performance benefit with high throughput applications.
* Fix rendering of selections outside the viewportChristian Duerr2018-09-28
| | | | | | | | | | | | | | | | | When rendering selections with both start and end outside of the visible area, Alacritty would assume that both start and end are either above or below the viewport and not render the selection at all. To fix this the `buffer_line_to_visible` method now returns a `ViewportPosition` instead of an `Option<Line>`, this allows giving more feedback about where outside of the visible region the line is using the `ViewportPosition::Above` and `ViewportPosition::Below` variants. Using these newly introduced variants, a selection spanning the whole screen is now rendered if the selection should go from above the visible area to below it. This fixes #1557.
* Fix selection of empty linesChristian Duerr2018-09-26
| | | | | | | | | | | | When selecting multiple lines in Alacritty, there was an issue with empty lines not being copied. This behavior has been chanaged so empty lines should be correctly copied now. When copying content which ends with an empty line, Alacritty would copy an additional empty line. This has been resolved by only adding empty lines when the empty line was not in the last selected line.