Commit graph

38 commits

Author SHA1 Message Date
Daniel Bertalan
c1e292e5bc LibVT: Correct color handling
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-17 18:19:49 +02:00
Daniel Bertalan
507ace5174 LibVT: Fix progress bars not getting reset 2021-05-17 18:19:49 +02:00
Daniel Bertalan
5d80debc1f LibVT: Fix newline handling
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-17 18:19:49 +02:00
Liav A
20743e8aed Kernel/Graphics + SystemServer: Support text mode properly
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-16 19:58:33 +02:00
Linus Groh
7ec8cb97e9 LibVT: Run clang-format on Terminal.cpp
Some trailing whitespace is causing the CI to fail. :^)
2021-05-16 15:16:50 +01:00
Daniel Bertalan
26953c2be1 LibVT: Implement ST (ESC \) escape sequence
Closes #7175
2021-05-16 15:53:02 +02:00
Daniel Bertalan
7b9051afe5 LibVT: Fix 8-bit control codes clobbering UTF-8
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-16 14:17:04 +02:00
Daniel Bertalan
e0b6cfec1a LibVT: fix SM/RM not respecting private markers
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-16 11:50:56 +02:00
Daniel Bertalan
be519022c3 LibVT: Implement new ANSI escape sequence parser
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-16 11:50:56 +02:00
Daniel Bertalan
1b347298f1 LibVT: Add state machine file for the new parser
The parser itself will be included in a later commit.
2021-05-16 11:50:56 +02:00
Gunnar Beutner
6cf59b6ae9 Everywhere: Turn #if *_DEBUG into dbgln_if/if constexpr 2021-05-01 21:25:06 +02:00
Andreas Kling
7ae7170d61 Everywhere: "file name" => "filename" 2021-04-29 22:16:18 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
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-22 11:22:27 +02:00
Andreas Kling
4e6d2374b6 LibVT: Convert String::format() => String::formatted() 2021-04-21 23:49:02 +02:00
Andreas Kling
a2baab38fd Everywhere: It's now "Foobar", not "FooBar", and not "foo bar"
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-13 16:58:15 +02:00
Andreas Kling
192e2d5d50 LibVT: Update TerminalWidget after double-click selection
Previously we had to wait for the cursor to blink before we actually
got to see what got selected from double-clicking.
2021-04-10 00:11:10 +02:00
Andreas Kling
c2b760e335 Terminal+LibVT: Add Alt shortcuts to menu actions 2021-04-09 17:08:49 +02:00
Andreas Kling
38f11cc1ba Everywhere: Rename "logo" key to "super" key
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-11 18:55:16 +01:00
Andreas Kling
9af1e1a3bf LibVT: New terminal cells should be filled with whitespace, not '\0' 2021-03-01 11:37:22 +01:00
Andreas Kling
2c1f71055f LibVT: Put TerminalWidget in the VT namespace :^) 2021-02-27 17:49:08 +01:00
Andreas Kling
b7c66233f6 LibVT: Make VT::Line use a Vector for storage
This is preparation for non-destructive terminal resizing which will
require more dynamic storage for lines.
2021-02-27 09:23:06 +01:00
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...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-23 20:56:54 +01:00
Andreas Kling
1e3a6ba572 LibVT: Avoid double relayout during interactive resize
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-21 16:52:22 +01:00
Linus Groh
368fe0f7f8 LibVT: Don't paint selection with opacity
Fixes #5442.
2021-02-21 10:33:22 +01:00
Andreas Kling
542d8591e0 LibVT: Oops, fix dbgln() invocation mistake 2021-02-20 17:16:33 +01:00
Andreas Kling
499a59ed86 LibVT: Put "unimplemented escape" whining on debug log
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-20 17:04:46 +01:00
Andreas Kling
81b21504a7 LibVT: Implement switching between 80/132 column modes (DECCOLM)
This gets us past a few more screens in vttest. :^)
2021-02-20 17:04:46 +01:00
Andreas Kling
8c9ae4e537 Terminal+LibVT: Resize Terminal app window when requested by VT
This will allow us to react to things like DECCOLM.
2021-02-20 17:04:46 +01:00
Andreas Kling
bb6d6dce7b LibVT: Give proper names to remaining VTxxx control functions 2021-02-20 17:04:46 +01:00
Andreas Kling
a59d96e461 LibVT: Give proper names to SD and SU 2021-02-20 17:04:46 +01:00
Andreas Kling
75084d3b3f LibVT: Move control function doc comments to Terminal.h header
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-20 17:04:46 +01:00
Andreas Kling
6c7c6de52b LibVT: Give proper names to SCOSC and SCORC 2021-02-20 17:04:46 +01:00
Andreas Kling
fc2a4511ec LibVT: Clean up TerminalWidget a bit, removing unused cruft 2021-02-15 19:58:47 +01:00
asynts
eea72b9b5c Everywhere: Hook up remaining debug macros to Debug.h. 2021-01-25 09:47:36 +01:00
asynts
acdcf59a33 Everywhere: Remove unnecessary debug comments.
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-25 09:47:36 +01:00
Andreas Kling
c16e36be48 LibVT: Convert dbgprintf() => dbgln() and remove some debug code 2021-01-16 23:21:52 +01:00
asynts
adbb8d62d1 Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
2021-01-16 11:54:35 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00