summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibVT
AgeCommit message (Collapse)Author
2021-12-16Terminal: Fix broken selection after dbl/trp clickryanb-dev
This commit resets the terminal triple click timer when appropriate.
2021-12-05LibVT: Cast unused smart-pointer return value to voidSam Atkins
2021-11-21LibGUI+Everywhere: Make sync requests to Clipboard server more obviousBen Wiederhake
2021-11-21LibVT: Make paste access to Clipboard atomicBen Wiederhake
This avoids data race issues and saves a synchronous request to ClipboardServer.
2021-11-13LibVT: Show action of double click in tooltipDavid Lindbom
When hovering an item in Terminal we now show what application will handle it, e.g "Open app-catdog.png in ImageViewer". If the file is its own handler, i.e an executable, it will show "Execute myscript.sh"
2021-11-11Everywhere: Pass AK::ReadonlyBytes by valueAndreas Kling
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()Andreas Kling
This was used in a lot of places, so this patch makes liberal use of ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-11-02Libraries: Fix visibility of Object-derivative constructorsBen Wiederhake
Derivatives of Core::Object should be constructed through ClassName::construct(), to avoid handling ref-counted objects with refcount zero. Fixing the visibility means that misuses like this are more difficult.
2021-10-27Everywhere: Rename left/right-click to primary/secondaryFiliph Sandström
This resolves #10641.
2021-10-06LibVT: Add missing headersBen Wiederhake
2021-10-02LibVT: Implement G0..G3 and VT100 translation tableJelle Raaijmakers
2021-10-02LibVT: Implement support for Cursor Keys Mode (DECCKM)Jelle Raaijmakers
2021-10-02LibVT: Add stubs for DECPNM, DECPAMJelle Raaijmakers
Still not implemented, but provides easier to grasp FIXMEs.
2021-09-19LibVT: Add movemouse support for triple clickbrapru
When moving the mouse after a triple click, the selected buffer does not maintain the whole line selection. This patch will allow triple click highlighting to hold the whole line selection.
2021-09-19LibVT: Keep track of the buffer postiion on mousedown eventsbrapru
2021-09-16LibVT: Use default instead of an empty constructor/destructorBrian Gianforcaro
Default implementations allow for more optimizations. See: https://pvs-studio.com/en/docs/warnings/v832/
2021-09-02LibVT: Execute DragOperation after resetting active hyperlinkMusab Kılıç
2021-08-26Terminal+LibVT: Use LibConfig instead of Core::ConfigFileAndreas Kling
2021-08-02Userland: Make use of container version of any_ofLenny Maiorani
Problem: - New `any_of` implementation takes the entire container so the user does not need to pass explicit begin/end iterators. This is unused except is in tests. Solution: - Make use of the new and more user-friendly version where possible.
2021-08-01Libraries: Remove unused header includesBrian Gianforcaro
2021-07-27LibGUI: Add a ClipboardClient for GUI::ClipboardTheFightingCatfish
Anyone who inherits from `GUI::Clipboard::ClipboardClient` will receive clipboard notifications via `clipboard_content_did_change()`. Update ClipboardHistoryModel, TextEditor and TerminalWidget to inherit from this class.
2021-07-21LibGfx: Use "try_" prefix for static factory functionsAndreas Kling
Also mark them as [[nodiscard]].
2021-07-19Everywhere: Use AK/Math.h if applicableHendiadyoin1
AK's version should see better inlining behaviors, than the LibM one. We avoid mixed usage for now though. Also clean up some stale math includes and improper floatingpoint usage.
2021-07-10Terminal: Put debug spam in unimplemented_control_code() behind a flagAndreas Kling
2021-07-10LibVT: Reset scrollbar after switching to/from the alternate bufferDaniel Bertalan
We did not call the history change callback after switching to the alternate screen buffer, which caused the scrollbar to not change its maximum value. If we already had lines in the scrollback buffer, this meant that we could drag the scrollbar, which then tried to access non-existent lines from the scrollback. Fixes #8581
2021-07-09LibVT: Always check intermediate bytes in CSI sequencesDaniel Bertalan
Previously, we only checked the intermediate bytes for those escape sequences that performed different operations based on their intermediate bytes. This lead to a crash when `CSI ?1001 r` was incorrectly parsed as `CSI Pt ; Pb r` (note the missing question mark), as seen in #8559.
2021-07-08LibVT: Ignore DECSTBM with invalid values (#8559)pancake
Co-authored-by: pancake <pancake@nopcode.org>
2021-06-30AK+Everywhere: Add and use static APIs for LexicalPathMax Wipfli
The LexicalPath instance methods dirname(), basename(), title() and extension() will be changed to return StringView const& in a further commit. Due to this, users creating temporary LexicalPath objects just to call one of those getters will recieve a StringView const& pointing to a possible freed buffer. To avoid this, static methods for those APIs have been added, which will return a String by value to avoid those problems. All cases where temporary LexicalPath objects have been used as described above haven been changed to use the static APIs.
2021-06-29LibVT: Paste full path when dropping file on widgetXavier Defrang
Prioritize URLs over plain text content in order to insert absolute path instead of basename
2021-06-24LibVT: Only resize the line after all rewrapping is doneAli Mohammad Pur
Otherwise we would end up inserting empty cells into the wrapped lines. Fixes #8227.
2021-06-23LibVT: Rewrap the terminal history along with the normal bufferAli Mohammad Pur
2021-06-23LibVT+Terminal: Implement line wrappingAli Mohammad Pur
This commit implements line wrapping in the terminal, and tries its best to move the cursor to the "correct" position.
2021-06-23LibVT: Keep track of the 'true' line endingsAli Mohammad Pur
2021-06-23LibVT: Don't crash when clicking outside of the terminal's buffer areaGunnar Beutner
When resizing a terminal window the number of columns may change. Previously we assumed that this also affects lines which were in the terminal's buffer while that is not necessarily true.
2021-06-10LibVT: Implement `DECIC`/`DECDC`Daniel Bertalan
This commit adds support for these escape sequences that are used for scrolling multiple lines at once. In the current, unoptimized implementation, these just call the `scroll_left` and `scroll_right` APIs multiple times. It's a VT420 feature.
2021-06-10Kernel+LibVT: Fix selection with scrollback wrap-aroundDaniel Bertalan
If lines are removed from the tail of the scrollback buffer, the previous line indices will refer to different lines; therefore we need to offset them.
2021-06-10LibVT: Implement `DECFI` and `DECBI`Daniel Bertalan
These escape sequences are the horizontal scrolling equivalents of `IND` and `RI`. Normally, they move the cursor forward or backward. But if they hit the margins (which we just treat as the first and last columns), they scroll the line. Another VT420 feature done.
2021-06-10Kernel+LibVT: Implement left-right scrollingDaniel Bertalan
This commit implements the left/right scrolling used in the `ICH`/`DCH` escape sequences for `VirtualConsole`. This brings us one step closer to VT420/xterm compatibility. We can now finally remove the last escape sequence related `ifdef`s.
2021-06-10Kernel+LibVT: Add function for deleting a range of charactersDaniel Bertalan
Previously, this was done by telling the client to put a space at each character in the range. This was inefficient, because a large number of function calls took place and incorrect, as the ANSI standard dictates that character attributes should be cleared as well. The newly added `clear_in_line` function solves this issue. It performs just one bounds check when it's called and can be implemented as a pretty tight loop.
2021-06-10LibVT+Kernel: Support clearing the scrollback bufferDaniel Bertalan
As per the `xterm ctlseqs` documentation, `\e3J` should clear the scrollback buffer, and leave the visible lines unchanged. This commit fixes a FIXME.
2021-06-10LibVT: Improve scrolling performanceDaniel Bertalan
Previously, we would remove lines from the buffer, create new lines and insert them into the buffer when we scrolled. Since scrolling does not always happen at the last line, this meant `Line` objects were pointlessly moved forwards, and then immediately backwards. We now swap them in-place and clear those lines that are "inserted". As a result, performance is better and scrolling is smoother in `vim` and `nano`.
2021-06-10LibVT: Fix `ECH` not clearing linesDaniel Bertalan
The `num` parameter should be treated as an offset from the cursor position, not from the beginning of the line. The previous behavior caused fragments of previous lines to be visible when moving the entire buffer in vim (e.g. with `gg` and `G`). The debug messages I used while fixing it are also included in this commit. These will help diagnose further issues if they arise.
2021-06-10LibVT+Kernel: Clean up scroll APIDaniel Bertalan
This commit cleans up some of the `#ifdef`-ed code smell in `Terminal`, by extending the scroll APIs to take a range of lines as a parameter. This makes it possible to use the same code for `IL`/`DL` as for scrolling. Note that the current scrolling implementation is very naive, and does many insertions/deletions in the middle of arrays, whereas swaps should be enough. This optimization will come in a later commit. The `linefeed` override was removed from `VirtualConsole`. Previously, it exhibited incorrect behavior by moving to column 0. Now that we use the method defined in `Terminal`, code which relied on this behavior stopped working. We go instead go through the TTY layer which handles the various output flags. Passing the input character-by-character seems a bit excessive, so a fix for it will come in another PR.
2021-06-10LibVT: Fix out-of-bounds reads in ICH/DCH escape sequencesDaniel Bertalan
Previously, entering too big counts for these commands could cause a wrap-around with the cell indices. Also, we are now correctly copying the cell attributes as well as the code point.
2021-06-05LibVT: Don't return a history size if alternate buffer is usedTim Schumacher
The line history is unavailable if the alternate screen buffer is currently enabled. However, since TerminalWidget uses the history size to offset its line numbers when rendering, it will try to render inaccessible lines once the history is not empty anymore.
2021-06-04LibVT: Fix underlines incorrectly rendering in redDaniel Bertalan
Previously, `href` attributes weren't checked for not being empty when drawing their underlines. This caused any underline to be treated as an active `href`, hence the red color.
2021-06-04LibVT: Implement bright color supportDaniel Bertalan
Previously, we only used bright colors when the bold attribute was set. We now have the option to set it via escape sequences. We also needed to make the bold text behavior optional, as some color schemes do weird things with it. For example, Solarized uses it for various shades of gray, so bold green would turn into a light shade of gray. The following new escape sequences are supported: - `CSI 90;m` to `CSI 97;m`: set bright foreground color - `CSI 100;m` to `CSI 107;m`: set bright background color
2021-06-04LibVT+Terminal: Add color scheme supportDaniel Bertalan
This commit introduces color scheme support to Terminal. These are found in `/res/terminal_colors` and the default color scheme can be set in `~/.config/Terminal.ini`. Furthermore, a combo box is added for setting the color scheme at runtime. The previously used default color scheme has been added to `/res/terminal-colors/Default.ini`. To make the implementation more compatible with other color schemes, `TerminalWidget` now supports overriding the default foreground and background colors.
2021-06-04LibVT+Kernel: Create `Color` classDaniel Bertalan
Previously, we converted colors to their RGB values immediately when they were set. This meant that their semantic meaning was lost, we could not tell a precise RGB value apart from a named/indexed color. The new way of storing colors will allow us to retain this information, so we can change a color scheme on the fly, and previously emitted text will also be affected.