summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibVT
AgeCommit message (Collapse)Author
2021-05-24LibVT: Fix out-of bounds line insertDaniel Bertalan
Unless DECOM mode is enabled, the cursor positions are measured from the top left corner of the screen. We counted from the top margin, causing line inserts in `vim` to go out-of-bounds and crash the terminal.
2021-05-24LibVT: Fix issues running `nano`Daniel Bertalan
This commit fixes 3 correctness issues with the ANSI escape sequence handling logic: 1. Default parameters were not handled correctly: the specification says that 0-valued CSI escape sequence parameters should take their default values. 2. We did not call `scroll_{up, down}` when encountering RI/IND commands that reached the scroll margins. This caused nano to only scroll the first line.
2021-05-24LibVT: Add Alternate Screen Buffer supportDaniel Bertalan
The Alternate Screen Buffer is used by full-screen terminal applications (like `vim` and `nano`). Its data is stored separately from the normal buffer, therefore after applications using it exit, everything looks like it was before, the bottom of their interfaces isn't visible. An interesting feature is that it does not support scrollback, so it consumes less memory by not having to allocate lines for history. Because of the need to save and restore state between the switches, some correctness issues relating to it were also fixed in this commit.
2021-05-24LibVT: Implement Bracketed Paste ModeDaniel Bertalan
This mode allow us to escape any data that was not directly typed by the user. `vim` currently uses this. If we implement it in the shell, we could prevent newlines from being injected into the shell by pasting text or dragging files into it (see #7276).
2021-05-24LibVT: Add title stack supportDaniel Bertalan
This feature allows applications to reset the window title once they exited. It is used by `vim` if `set title` is enabled.
2021-05-24LibVT+Kernel: Add support for setting cursor stylesDaniel Bertalan
This commit introduces support for 3 new escape sequences: 1. Stop blinking cursor mode 2. `DECTCEM` mode (enable/disable cursor) 3. `DECSCUSR` (set cursor style) `TerminalWidget` now supports the following cursor types: block, underline and vertical bar. Each of these can blink or be steady. `VirtualConsole` ignores these (just as we were doing before).
2021-05-22LibVT: Fix UTF-8 handling in OSC sequencesDaniel Bertalan
Previously, we would ignore bytes in the `0x80..0xff` range when parsing OSC strings. This caused terminal titles and hyperlinks containing non-ASCII characters to fail. Also added is extending the UTF-8 fail functionality for C1 control codes, since we do not handle those. Fixes #7377
2021-05-22LibVT: Don't cache bold variant of VT font in a member variableAndreas Kling
Remove some leftovers from back when we had to resolve a bold variant of the terminal font manually. Now we can just use bold_variant().
2021-05-21Applications: Use titlecase and distinct underlined characters in menusMax Wipfli
This changes (context) menus across the system to conform to titlecase capitalization and to not underline the same character twice (for accessing actions with Alt).
2021-05-21Revert "Userland: static vs non-static constexpr variables"Linus Groh
This reverts commit 800ea8ea969835297dc7e7da345a45b9dc5e751a. Booting the system no longer worked after these changes.
2021-05-21Userland: static vs non-static constexpr variablesLenny Maiorani
Problem: - `static` variables consume memory and sometimes are less optimizable. - `static const` variables can be `constexpr`, usually. - `static` function-local variables require an initialization check every time the function is run. Solution: - If a global `static` variable is only used in a single function then move it into the function and make it non-`static` and `constexpr`. - Make all global `static` variables `constexpr` instead of `const`. - Change function-local `static const[expr]` variables to be just `constexpr`.
2021-05-20LibGfx: Remove Gfx::FontDatabase::default_bold_fixed_width_font()Andreas Kling
Ask for a bold_variant() of the default_fixed_width_font() instead.
2021-05-20Meta: Make generate_state_machine() generate a proper targetAli Mohammad Pur
And use GENERATED_SOURCES (or add_dependencies) to make LibVT depend on that target. Fixes a FIXME.
2021-05-17LibVT: Correct color handlingDaniel Bertalan
VT100's documentation says that more than one SGR (Set Graphics Rendition) parameters may be included in a single escape sequence. However, we treated those with more than 3 parameters as color sequences, so this behavior was not replicated.
2021-05-17LibVT: Fix progress bars not getting resetDaniel Bertalan
2021-05-17LibVT: Fix newline handlingDaniel Bertalan
Before this commit, we would jump to the first column after receiving the '\n' line feed character. This is not the correct behavior, as it should only move the cursor now. Translating the typed Return key into the correct CR LF ("\r\n") is the TTY's job, which was fixed in #7184. Fixes #6820 Fixes #6960
2021-05-16Kernel/Graphics + SystemServer: Support text mode properlyLiav A
As we removed the support of VBE modesetting that was done by GRUB early on boot, we need to determine if we can modeset the resolution with our drivers, and if not, we should enable text mode and ensure that SystemServer knows about it too. Also, SystemServer should first check if there's a framebuffer device node, which is an indication that text mode was not even if it was requested. Then, if it doesn't find it, it should check what boot_mode argument the user specified (in case it's self-test). This way if we try to use bochs-display device (which is not VGA compatible) and request a text mode, it will not honor the request and will continue with graphical mode. Also try to print critical messages with mininum memory allocations possible. In LibVT, We make the implementation flexible for kernel-specific methods that are implemented in ConsoleImpl class.
2021-05-16LibVT: Run clang-format on Terminal.cppLinus Groh
Some trailing whitespace is causing the CI to fail. :^)
2021-05-16LibVT: Implement ST (ESC \) escape sequenceDaniel Bertalan
Closes #7175
2021-05-16LibVT: Fix 8-bit control codes clobbering UTF-8Daniel Bertalan
Bytes in the 0x80..0x9F range were treated as C1 control codes, which prevented them from being parsed as UTF-8 bytes. This caused some characters (like U+DF, encoded as 0xC3 0x9F) from being recognized as printable characters.
2021-05-16LibVT: fix SM/RM not respecting private markersDaniel Bertalan
Since we now store intermediate characters separately, the intermediates should be checked for the presence of the '?' DEC private marker, not the first parameter.
2021-05-16LibVT: Implement new ANSI escape sequence parserDaniel Bertalan
This commit replaces the former, hand-written parser with a new one that can be generated automatically according to a state change diagram. The new `EscapeSequenceParser` class provides a more ergonomic interface to dealing with escape sequences. This interface has been inspired by Alacritty's [vte library](https://github.com/alacritty/vte/). I tried to avoid changing the application logic inside the `Terminal` class. While this code has not been thoroughly tested, I can't find regressions in the basic command line utilities or `vttest`. `Terminal` now displays nicer debug messages when it encounters an unknown escape sequence. Defensive programming and bounds checks have been added where we access parameters, and as a result, we can now endure 4-5 seconds of `cat /dev/urandom`. :D We generate EscapeSequenceStateMachine.h when building the in-kernel LibVT, and we assume that the file is already in place when the userland library is being built. This will probably cause problems later on, but I can't find a way to do it nicely.
2021-05-16LibVT: Add state machine file for the new parserDaniel Bertalan
The parser itself will be included in a later commit.
2021-05-01Everywhere: Turn #if *_DEBUG into dbgln_if/if constexprGunnar Beutner
2021-04-29Everywhere: "file name" => "filename"Andreas Kling
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-21LibVT: Convert String::format() => String::formatted()Andreas Kling
2021-04-13Everywhere: It's now "Foobar", not "FooBar", and not "foo bar"Andreas Kling
I hereby declare these to be full nouns that we don't split, neither by space, nor by underscore: - Breadcrumbbar - Coolbar - Menubar - Progressbar - Scrollbar - Statusbar - Taskbar - Toolbar This patch makes everything consistent by replacing every other variant of these with the proper one. :^)
2021-04-10LibVT: Update TerminalWidget after double-click selectionAndreas Kling
Previously we had to wait for the cursor to blink before we actually got to see what got selected from double-clicking.
2021-04-09Terminal+LibVT: Add Alt shortcuts to menu actionsAndreas Kling
2021-03-11Everywhere: Rename "logo" key to "super" keyAndreas Kling
This seems to be the most common way to refer to this key, so let's call it what people actually call it.
2021-03-01LibVT: New terminal cells should be filled with whitespace, not '\0'Andreas Kling
2021-02-27LibVT: Put TerminalWidget in the VT namespace :^)Andreas Kling
2021-02-27LibVT: Make VT::Line use a Vector for storageAndreas Kling
This is preparation for non-destructive terminal resizing which will require more dynamic storage for lines.
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-02-21LibVT: Avoid double relayout during interactive resizeAndreas Kling
Don't fire the on_terminal_size hook while we're in relayout. This fixes the terminal window flopping around during interactive resizing. (It was mostly noticeable if something else was hogging the CPU at the same time.)
2021-02-21LibVT: Don't paint selection with opacityLinus Groh
Fixes #5442.
2021-02-20LibVT: Oops, fix dbgln() invocation mistakeAndreas Kling
2021-02-20LibVT: Put "unimplemented escape" whining on debug logAndreas Kling
I'm not sure why we were injecting these debug messages into the terminal output, but it makes a big mess for no benefit.
2021-02-20LibVT: Implement switching between 80/132 column modes (DECCOLM)Andreas Kling
This gets us past a few more screens in vttest. :^)
2021-02-20Terminal+LibVT: Resize Terminal app window when requested by VTAndreas Kling
This will allow us to react to things like DECCOLM.
2021-02-20LibVT: Give proper names to remaining VTxxx control functionsAndreas Kling
2021-02-20LibVT: Give proper names to SD and SUAndreas Kling
2021-02-20LibVT: Move control function doc comments to Terminal.h headerAndreas Kling
Putting the little documentation comment about what each VTxxx control function does in the header allows them to be picked up by IDE's.
2021-02-20LibVT: Give proper names to SCOSC and SCORCAndreas Kling
2021-02-15LibVT: Clean up TerminalWidget a bit, removing unused cruftAndreas Kling
2021-01-25Everywhere: Hook up remaining debug macros to Debug.h.asynts
2021-01-25Everywhere: Remove unnecessary debug comments.asynts
It would be tempting to uncomment these statements, but that won't work with the new changes. This was done with the following commands: find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/#define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/#define/ { toggle = 1 }' {} \; find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/ #define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/ #define/ { toggle = 1 }' {} \;
2021-01-16LibVT: Convert dbgprintf() => dbgln() and remove some debug codeAndreas Kling
2021-01-16Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.