Commit graph

9568 commits

Author SHA1 Message Date
AnotherTest a4e0b585fe AK: Add a way to get the number of valid bytes in a Utf8View 2020-05-18 11:31:43 +02:00
Linus Groh 07c765e258 Ports: Make bash link again
No idea why this was suddenly broken, but removing these duplicated
declarations make it build to completion again.
2020-05-18 11:29:08 +02:00
Nicholas Hollett 181eacd3ba LibVT: Pass the handler name to Launcher::open_url to control what gets launched
Now we can pick which application gets opened in the context menu for
URLs in the Terminal \o/
2020-05-18 11:27:27 +02:00
Nicholas Hollett 02cc3ac21f Base: Add file type & protocol definitions for known handlers.
This matches the existing user configuration in /home/anon/LaunchServer.ini
2020-05-18 11:27:27 +02:00
Nicholas Hollett 3c5f75ed53 LaunchServer: Discover handlers from *.af files, allow launching based on a known handler
Adds metadata about apps for what file types and protocols they can
handle, then consumes that in the LaunchServer. The LaunchServer can
then use that to offer multiple options for what apps can open a given
URL. Callers can then pass back the handler name to the LaunchServer to
use an alternate app :)
2020-05-18 11:27:27 +02:00
Linus Groh 36996bd720 LibJS: Rename to_{i32,size_t}() to as_{i32,size_t}() for clarity
As these parameter-less overloads don't change the value's type and
just assume Type::Number, naming them as_i32() and as_size_t() is more
appropriate.
2020-05-18 10:21:51 +02:00
Andreas Kling 014cb1a55b LibGUI: Tweak EmojiInputDialog layout :^) 2020-05-18 09:55:19 +02:00
Andreas Kling 5aba8cc750 Base: Add thinking face emoji (U+1F914) 🤔 2020-05-18 09:52:48 +02:00
Linus Groh 56502b0e84 LibJS: Check for exception after converting object to string primitive 2020-05-18 09:39:55 +02:00
Linus Groh 4569e88bea LibJS: Throw TypeError when coercing symbol to number 2020-05-18 09:39:55 +02:00
Linus Groh 476094922b LibJS: Pass Interpreter& to Value::to_number() et al.
This patch is unfortunately rather large and might make some things feel
bloated, but it is necessary to fix a few flaws in LibJS, primarily
blindly coercing values to numbers without exception checks - i.e.

interpreter.argument(0).to_i32();  // can fail!!!

Some examples where the interpreter would actually crash:

var o = { toString: () => { throw Error() } };
+o;
o - 1;
"foo".charAt(o);
"bar".repeat(o);

To fix this, we now have the following...

to_double(Interpreter&)
to_i32()
to_i32(Interpreter&)
to_size_t()
to_size_t(Interpreter&)

...and a whole lot of exception checking.

There's intentionally no to_double(), use as_double() directly instead.

This way we still can use these convenient utility functions but don't
need to check for exceptions if we are sure the value already is a
number.

Fixes #2267.
2020-05-18 09:39:55 +02:00
Linus Groh 1a1394f7a2 LibJS: Change Value::to_object(Heap& -> Interpreter&)
Passing a Heap& to it only to then call interpreter() on that is weird.
Let's just give it the Interpreter& directly, like some of the other
to_something() functions.
2020-05-18 09:39:55 +02:00
Linus Groh b8b7f84547 LibJS: Remove no-op SymbolPrototype::description_setter()
We can just give put_native_property() a nullptr for the setter.
2020-05-18 09:36:14 +02:00
jarhill0 50c116e57b Base: Add smiling face with horns emoji (U+1F608) 😈 2020-05-18 09:36:00 +02:00
jarhill0 50336dc6ff Base: Add splashing sweat emoji (U+1F4A6) 💦 2020-05-18 09:36:00 +02:00
jarhill0 ec8edee19e Base: Add cherries emoji (U+1F352) 🍒 2020-05-18 09:36:00 +02:00
jarhill0 5fa40080cd Base: Add peach emoji (U+1F351) 🍑 2020-05-18 09:36:00 +02:00
jarhill0 aabad11dbf Base: Add eggplant emoji (U+1F346) 🍆 2020-05-18 09:36:00 +02:00
jarhill0 054385ae0e Base: Add Cancer emoji (U+264B) 2020-05-18 09:36:00 +02:00
Devashish e4f7080bbd Meta: Update CLion and WSL configuration documentations
This commit updates CLionConfiguration.md and NotesOnWSL.md so that
they comply with new build system. In addition to that, the WSL doc
is updated to include instructions to run qemu (and serenity) natively
on Windows, without needing an X-window server.
2020-05-17 23:07:35 +02:00
Andreas Kling 6060c7444b LibGUI: Fix crash in TextDocument::remove(TextRange)
Oops, we can't be appending substrings of a string we just deleted!

Fix this by building up the new line instead of trying to clear and
append in place. This works out nicely as we now do fewer document view
updates when removing a range. :^)
2020-05-17 22:35:25 +02:00
Andreas Kling 30a3b8333a LibVT: TerminalWidget now opts into emoji input by default :^) 2020-05-17 22:35:25 +02:00
Andreas Kling 604fb278c1 LibGUI: TextEditor now opts in to emoji input by default :^) 2020-05-17 22:35:25 +02:00
Andreas Kling 4173905198 LibGUI: Add a simple emoji input dialog activated by Ctrl+Alt+Space :^)
Widgets can now opt in to emoji input via set_accepts_emoji_input().
If the focused widget accepts emoji input, we'll pop up a simple dialog
with all the available emojis as clickable buttons.

You can press escape if you change your mind and don't want an emoji.

This UI layout definitely will not scale as we add more emojis, but it
works for the moment, and we can adapt it as we go. Pretty cool! :^)
2020-05-17 22:35:25 +02:00
Andreas Kling 1b78d9fa1f LibVT: Handle keydown events with multi-byte text correctly
TerminalWidget can now handle keydown events that contain multi-byte
UTF-8 sequences. :^)
2020-05-17 22:35:25 +02:00
Andreas Kling 1bef057ec3 LibGUI: Make the TextEditor widget store UTF-32 codepoints
A TextDocumentLine is now backed by a non-null-terminated sequence of
Unicode codepoints encoded as UTF-32 (one u32 per codepoint.)

This makes it possible to view and edit arbitrary Unicode text without
strange cursor and selection behavior. You can freely copy and paste
emojis between TextEditor and Terminal now. :^)

Storing UTF-32 is quite space-inefficient, but we should be able to
use the same optimization techniques as LibVT does to reduce it in
the typical case where most text is ASCII.

There are a lot of things that can be cleaned up around this code,
but this works well enough that I'm pretty happy with it.
2020-05-17 22:35:25 +02:00
Andreas Kling 0272bbb4fb LibGfx: Add UTF-32 version of the text painting code paths
There's a large amount of code duplication here right now, which will
need to be reduced.
2020-05-17 22:35:25 +02:00
Andreas Kling 0d78ee95f9 LibVT: Make TerminalWidget::selected_text() produce UTF-8 strings :^) 2020-05-17 22:35:25 +02:00
Andreas Kling 86242f9c18 AK: Add StringBuilder::append(Utf32View)
This encodes the incoming UTF-32 sequence as UTF-8.
2020-05-17 22:35:25 +02:00
Andreas Kling bc6f469544 LibGfx: Let's make it Font::width(Utf32View) 2020-05-17 22:35:25 +02:00
Andreas Kling 00b5614ce2 AK: Add a very basic Utf32View class
This allows you to wrap a { const u32* codepoints, size_t length } in a
simple object.
2020-05-17 22:35:25 +02:00
Andreas Kling b3f6b43d3c LibC: Don't let ctype isfoo() helpers access array out of bounds 2020-05-17 22:35:25 +02:00
Andreas Kling 35875b68f5 LibGfx: Add Font::width(u32* codepoints, size_t)
This allows you to measure the width of a UTF-32 sequence.
2020-05-17 22:35:25 +02:00
mattco98 4ced126704 LibJS: Add symbol objects
This commit adds the following classes: SymbolObject, SymbolConstructor,
SymbolPrototype, and Symbol. This commit does not introduce any
new functionality to the Object class, so they cannot be used as
property keys in objects.
2020-05-17 18:05:15 +02:00
Conrad Pankoff b5b08fba92 AK: Make sure URL retains trailing slash if present in complete_url 2020-05-17 16:35:42 +02:00
AnotherTest 013cb76d77 LibGemini: Implement rendering text/gemini documents to HTML
This also sets Content-Type to whatever 'meta' contains on success, to
allow the browser to pick up what the document contains.
2020-05-17 16:35:42 +02:00
Andreas Kling a4902e0eec ProtocolServer: Put everything in the ProtocolServer namespace 2020-05-17 16:33:09 +02:00
Andreas Kling 2949c3e5e1 Meta: Add Linus, Ali and Shannon to the "Contributors" list
I've been adding people here after they cross over the 100 commit line.
Make that criteria explicit in the text.
2020-05-17 16:27:51 +02:00
Linus Groh 71ec72bddf LibJS: Simplify various StringPrototype functions 2020-05-17 16:23:48 +02:00
Linus Groh 73eef31f49 LibJS: Add Number.parseFloat() 2020-05-17 16:21:38 +02:00
Linus Groh 6f6b089aa0 LibJS: Add parseFloat() 2020-05-17 16:21:33 +02:00
Andreas Kling cc42d75209 ls: Make column alignment Unicode-aware :^)
You can now have emojis in file names and they will line up correctly
in "ls" output.
2020-05-17 13:05:39 +02:00
Andreas Kling 6cde7e4d20 AK: Add Utf8View::length_in_codepoints() 2020-05-17 13:05:39 +02:00
AnotherTest 1469d20e63 Shell: Treat builtin names as programs and suggest them 2020-05-17 12:54:31 +02:00
Conrad Pankoff 87cb28fcf7 LibGemini+LibHTTP: Defer did_progress call to match other callbacks 2020-05-17 12:41:38 +02:00
Conrad Pankoff 4214680e76 AK: Set default port in URL to 1965 for gemini protocol 2020-05-17 12:41:38 +02:00
Conrad Pankoff f2621f37a4 ProtocolServer: Attach downloads and their lifecycles to clients
Previously a download lived independently of the client connection it came
from. This was the source of several undesirable behaviours, including the
potential for clients to influence downloads they didn't start, and
downloads living longer than their associated client connections. Now we
attach downloads to client connections, which means they're cleaned up
automatically when the client goes away, and there's significantly less
risk of clients interfering with each other.
2020-05-17 12:41:38 +02:00
Conrad Pankoff 184ee8ac77 LibWeb: Recognise and pass gemini URLs to ProtocolServer 2020-05-17 12:41:38 +02:00
Conrad Pankoff aaa6f90c34 ProtocolServer: Integrate LibGemini for simple requests 2020-05-17 12:41:38 +02:00
Conrad Pankoff 308a755c38 LibGemini: Implement basic Gemini protocol support 2020-05-17 12:41:38 +02:00