Commit Graph

21816 Commits

Author SHA1 Message Date
Daniel Bertalan
13991eade7 LibVT: Implement DECFI and DECBI
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-10 17:18:02 +02:00
Daniel Bertalan
89843cd692 Kernel+LibVT: Implement left-right scrolling
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-10 17:18:02 +02:00
Daniel Bertalan
7419569a2b Kernel+LibVT: Add function for deleting a range of characters
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-10 17:18:02 +02:00
Daniel Bertalan
8f8fd9c5a8 LibVT+Kernel: Support clearing the scrollback buffer
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-10 17:18:02 +02:00
Daniel Bertalan
221ba1aac8 LibVT: Improve scrolling performance
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-10 17:18:02 +02:00
Daniel Bertalan
fe58d15b5b LibVT: Fix ECH not clearing lines
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-10 17:18:02 +02:00
Daniel Bertalan
ae6bdc4e29 LibVT+Kernel: Clean up scroll API
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-10 17:18:02 +02:00
Daniel Bertalan
5f92790489 LibVT: Fix out-of-bounds reads in ICH/DCH escape sequences
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-10 17:18:02 +02:00
Luke
00a83a2957 LibJS: Make removed elements in Array.prototype.splice spec compliant
It wasn't using has_property, was directly appending to indexed
properties and wasn't setting the length.
2021-06-10 10:04:06 +01:00
Luke
bc540de0af LibJS: Pass in actual_delete_count to removed array creation in splice
More specifically, Array.prototype.splice. Additionally adds a missing
exception check to the array creation and a link to the spec.

Fixes create-non-array-invalid-len.js in the splice tests in test262.
This test timed out instead of throwing an "Invalid array length"
exception.
2021-06-10 10:04:06 +01:00
Idan Horowitz
f63ef4f196 LibJS: Stop asserting in {Set,Test}IntegrityLevel on missing descriptor
As per the specification (7.3.15 SetIntegrityLevel):
i. Let currentDesc be ? O.[[GetOwnProperty]](k).
ii. If currentDesc is not undefined, then...
2021-06-10 09:20:05 +01:00
Linus Groh
b639bf64f2 LibJS: Use create_list_from_array_like() in Function.prototype.apply() 2021-06-09 23:46:37 +01:00
Linus Groh
f932da095e LibJS: Use create_list_from_array_like() in Reflect.{apply,construct}() 2021-06-09 23:46:37 +01:00
Linus Groh
ad7aa05cc6 LibJS: Implement the CreateListFromArrayLike() abstract operation
We already have two separate implementations of this, so let's do it
properly. The optional value type check is done by a callback function
that returns Result<void, ErrorType> - value type accepted or message
for TypeError, that is.
2021-06-09 23:46:37 +01:00
Luke
5da94b30eb LibJS: Add logical assignment bytecode generation 2021-06-10 00:28:34 +02:00
Andreas Kling
4bc98fd39f LibJS: Only "var" declarations go in the global object at program level
"let" and "const" go in the lexical environment.

This fixes one part of #4001 (Lexically declared variables are mixed up
with global object properties)
2021-06-09 23:25:16 +02:00
Marcus Nilsson
d5fa0ea60f FileManager: Save maximized window state on exit
When exiting FileManager in maximized state, save it and start in
maximized state on next launch.
2021-06-09 22:58:10 +02:00
Marcus Nilsson
2f7dc29ab7 LibGUI/WindowServer: Add set_maximized IPC call
Add an IPC call to enable the client to manually maximize it's own
window.
2021-06-09 22:58:10 +02:00
Idan Horowitz
a00d154522 LibJS: Notify WeakSets when heap cells are sweeped
This is an implementation of the following optional optimization:
https://tc39.es/ecma262/#sec-weakref-execution
2021-06-09 21:52:25 +01:00
Idan Horowitz
fb63aeae4d LibJS: Add all of the WeakSet.prototype methods (add, delete, has) 2021-06-09 21:52:25 +01:00
Idan Horowitz
8b6beac5ce LibJS: Add the WeakSet built-in object 2021-06-09 21:52:25 +01:00
Itamar
ee9fe288b2 LibCpp: Add test for parsing class definitions 2021-06-09 22:26:46 +02:00
Itamar
7de6c1489b LibCpp: Parse basic constructors and destructors 2021-06-09 22:26:46 +02:00
Itamar
fd851ec5c9 LibCpp: Handle class access-specifiers in the Parser
We can now handle access-specifier tags (for example 'private:') when
parsing class declarations.

We currently only consume these tags on move on. We'll need to add some
logic that accounts for the access level of symbols down the road.
2021-06-09 22:26:46 +02:00
Itamar
dcdb0c7035 LibCpp: Support non-field class members
Previously, we had a special ASTNode for class members,
"MemberDeclaration", which only represented fields.

This commit removes MemberDeclaration and instead uses regular
Declaration nodes for representing the members of a class.

This means that we can now also parse methods, inner-classes, and other
declarations that appear inside of a class.
2021-06-09 22:26:46 +02:00
Itamar
8f074222e8 LibCpp: Make 'bool' a Token::Type::KnownType 2021-06-09 22:26:46 +02:00
Gunnar Beutner
9dc9ddbf82 LibJS: Fix evaluation order for tagged template literals
This ensures that the tag function is evaluated first.
2021-06-09 22:26:27 +02:00
Gunnar Beutner
2d48fe894f LibJS: Generate bytecode for tagged template literals 2021-06-09 21:54:31 +02:00
Gunnar Beutner
25ab31219c LibJS: Fix the return value for TemplateLiteral
This ensures that the bytecode generated for TemplateLiterals returns
the correct value.
2021-06-09 21:50:39 +02:00
Tobias Christiansen
6d3361f077 LibWeb: Fix logic issue when parsing CSS custom properties
With best wishes from De Morgan, this is the correct way to check
whether the string isn't of the form "var(...)".
2021-06-09 21:50:22 +02:00
Liav A
b54bfdd696 Kernel/PCI: Remove UNMAP_AFTER_INIT from a few methods
This fixes #7942.

We can't unmap these methods because they can be called after the boot
process from lspci(8) utility, or by using the SystemMonitor program
(and looking into the "PCI devices" tab).
2021-06-09 20:15:14 +01:00
Andreas Kling
d69cd3f5bf LibJS: Don't create lexical environment for native (C++) function calls
This was creating a ton of pointless busywork for the garbage collector
and can be avoided simply by tolerating that the current call frame has
a null scope object for the duration of a NativeFunction activation.
2021-06-09 20:54:01 +02:00
Thiago Henrique Hupner
d0bed24ca1 Ports: Add ZSH port 2021-06-09 19:41:23 +01:00
Thiago Henrique Hupner
4850cf9069 LibC: Add stub implementation for sigsuspend
Currently, ZSH tries to call this function and it always asserts,
so adding a stub to allow ZSH at least open.
2021-06-09 19:41:23 +01:00
Thiago Henrique Hupner
0f5a23d082 LibC: Make tgetnum() return -1 if capability is not available 2021-06-09 19:41:23 +01:00
Ali Mohammad Pur
aa2916c21b LibWasm: ALWAYS_INLINE some very hot functions
These function couldn't be inlined before because the compiler would've
started flagging invalid paths in Variant as maybe-uninitialized.
2021-06-09 23:05:32 +04:30
Ali Mohammad Pur
d3db45c60b AK: Make Vector::take_last() ALWAYS_INLINE
This function doesn't do a whole lot, but is called quite a bit.
2021-06-09 23:05:32 +04:30
Ali Mohammad Pur
8410d6aadb AK: Make a bunch of Variant methods ALWAYS_INLINE 2021-06-09 23:05:32 +04:30
Ali Mohammad Pur
50349de38c Meta: Disable -Wmaybe-uninitialized
It's prone to finding "technically uninitialized but can never happen"
cases, particularly in Optional<T> and Variant<Ts...>.
The general case seems to be that it cannot infer the dependency
between Variant's index (or Optional's boolean state) and a particular
alternative (or Optional's buffer) being untouched.
So it can flag cases like this:
```c++
if (index == StaticIndexForF)
    new (new_buffer) F(move(*bit_cast<F*>(old_buffer)));
```
The code in that branch can _technically_ make a partially initialized
`F`, but that path can never be taken since the buffer holding an
object of type `F` and the condition being true are correlated, and so
will never be taken _unless_ the buffer holds an object of type `F`.

This commit also removed the various 'diagnostic ignored' pragmas used
to work around this warning, as they no longer do anything.
2021-06-09 23:05:32 +04:30
Ali Mohammad Pur
45710d0724 LibWasm: Implement saturating float truncation instructions
With these, the only remaining unimplemented instructions are the
following:
- memory.init
- data.drop
- memory.copy
- memory.fill
- table.init
- elem.drop
- table.copy
- table.grow
- table.size
- table.fill
2021-06-09 23:05:32 +04:30
Ali Mohammad Pur
3a44011cd4 LibWasm: Implement sign extension instructions 2021-06-09 23:05:32 +04:30
Ali Mohammad Pur
a4c4dd928b LibWasm: Implement spec-compliant float min/max ops 2021-06-09 23:05:32 +04:30
Ali Mohammad Pur
ccc79149d4 wasm: Add a help command to the shell mode and start it on --shell 2021-06-09 23:05:32 +04:30
Nick Miller
2b789adc16 LibAudio: Add support for WAVE_FORMAT_EXTENSIBLE
This enables support for playing float32 and float64
WAVE_FORMAT_EXTENSIBLE files.

The PCM data format is encoded in the
first two bytes of the SubFormat GUID inside of the
WAVE_FORMAT_EXTENSIBLE `fmt` chunk.

Also, fixed the RIFF header size check to allow up to
maximum_wav_size (currently defined as 1 GiB).
The RIFF header size is the size of the entire
file, so it should be checked against the largest Wave size.
2021-06-09 22:58:44 +04:30
Liav A
d183f4b03f Documentation: Add a list of supported network cards 2021-06-09 22:44:09 +04:30
Liav A
84b2dc0fb8 Meta: Use Intel 82574 instead of Intel 82540 in the run script 2021-06-09 22:44:09 +04:30
Liav A
c6480a0426 Kernel/Net: Support Intel 82574 adapter
We call it E1000E, because the layout for these cards is somewhat not
the same like E1000 supported cards.

Also, this card supports advanced features that are not supported on
8254x cards.
2021-06-09 22:44:09 +04:30
Liav A
2e2201e8e1 Kernel/CommandLine: Add option to disable physical networking hardware
This is useful for debugging sessions mostly.
2021-06-09 22:44:09 +04:30
Liav A
1c94b5e8eb Kernel: Introduce the NetworkingManagement singleton
Instead of initializing network adapters in init.cpp, let's move that
logic into a separate class to handle this.
Also, it seems like a good idea to shift responsiblity on enumeration
of network adapters after the boot process, so this singleton will take
care of finding the appropriate network adapter when asked to with an
IPv4 address or interface name.

With this change being merged, we simplify the creation logic of
NetworkAdapter derived classes, so we enumerate the PCI bus only once,
searching for driver candidates when doing so, and we let each driver
to test if it is resposible for the specified PCI device.
2021-06-09 22:44:09 +04:30
Jelle Raaijmakers
8b1d4d1b8e Ports: Build an .so file for SQLite 2021-06-09 20:04:25 +02:00