Commit graph

104 commits

Author SHA1 Message Date
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
Andreas Kling
30a3b8333a LibVT: TerminalWidget now opts into emoji input by default :^) 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
0d78ee95f9 LibVT: Make TerminalWidget::selected_text() produce UTF-8 strings :^) 2020-05-17 22:35:25 +02:00
Andreas Kling
7b5b4bee70 LibVT: Store all-ASCII terminal lines as 8-bit characters
To conserve memory, we now use byte storage for terminal lines until we
encounter a non-ASCII codepoint. At that point, we transparently switch
to UTF-32 storage for that one line.
2020-05-17 12:32:09 +02:00
Andreas Kling
fa712d8aa5 LibVT: Don't try to set the window title to invalid UTF-8 text 2020-05-16 19:55:43 +02:00
Andreas Kling
b8498dc55e LibVT: Add incremental UTF-8 parsing to the terminal input handler
Instead of relying on the GUI code to handle UTF-8, we now process
and parse the incoming data into 32-bit codepoints ourselves.

This means that you can now show emojis in the terminal and they will
only take up one character cell each. :^)
2020-05-16 19:49:24 +02:00
Andreas Kling
06f3eb0ecd LibVT: Tweak input parsing related names 2020-05-16 19:30:46 +02:00
Andreas Kling
c4edc4c550 LibVT: Switch VT::Line to being backed by 32-bit codepoints
This will allow us to have much better Unicode support. It does incur
a memory usage regression which we'll have to optimize to cover.
2020-05-16 19:30:43 +02:00
Andreas Kling
16965db86b LibVT: Move out the Line class from Terminal to its own class 2020-05-15 18:57:50 +02:00
Sergey Bugaev
450a2a0f9c Build: Switch to CMake :^)
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-14 20:15:18 +02:00
Andreas Kling
f8e3c8326d Terminal: When offering to open a URL, show name + icon for handler app
Instead of just saying "Open URL" when you right click on a hyperlink
in the terminal, we now say something like "Open in Browser". :^)
2020-05-12 18:49:24 +02:00
AnotherTest
5b9fe0cf46 LibVT: Update the terminal buffer based on visible lines
Lines in the history should not be considered for update at all.
Fixes #2185
2020-05-11 09:33:18 +02:00
Andreas Kling
666863c2d8 LibVT: Clear the hovered hyperlink after completing a drag 2020-05-10 17:42:24 +02:00
Andreas Kling
f41bbdd46e LibVT: Allow dragging hyperlinks :^)
You can now drag a hyperlink as a text/uri-list. This allows you to
drag a file from "ls" output and drop it on a FileManager to copy
the file there. Truly futuristic stuff!
2020-05-10 17:39:11 +02:00
Andreas Kling
901d2e3236 LibVT: Make selection follow terminal history scrollback :^)
The buffer positions referred to by a VT::Position now include history
scrollback, meaning that a VT::Position with row=0 is at the start of
the history.

The active terminal buffer keeps moving in VT::Position coordinates
whenever we scroll. This allows selection to follow history. It also
allows us to click hyperlinks in history.

Fixes #957.
2020-05-10 16:59:02 +02:00
Andreas Kling
8af3af137e LibVT: Use the "ActiveLink" theme color for links being clicked
Okay, links are finally starting to feel visually intuitive. :^)
2020-05-10 16:14:49 +02:00
Andreas Kling
ab7de41c7b LibVT: Don't commit to opening a hyperlink until mouseup
It felt too rushed to open links when simply mousedown'ing on them.
Improve this by implementing basic "click" semantics instead.

This patch also introduces the ability to prevent link opening if you
want to force selection instead. Hold shift and we will not open links.
2020-05-10 16:01:08 +02:00
Andreas Kling
c10c6240f2 LibVT: Open hyperlinks on plain left-click instead of Ctrl+Click 2020-05-10 13:45:04 +02:00
Andreas Kling
3226276fe9 LibVT: Always draw hyperlinks with a dotted underline
The dotted line is custom painted to put some more distance between the
dots than what Painter::draw_line() does.
2020-05-10 13:43:56 +02:00
AnotherTest
8487806ec0 LibVT: Support RGB colors (\x1b[38;2;<r>;<g>;<b>m) 2020-05-10 10:23:05 +02:00
Andreas Kling
c3aa249a36 LibVT: Snapshot the URL we're opening a context menu for
Otherwise it may get lost due to a leave event firing in the widget.
2020-05-09 18:45:45 +02:00
Andreas Kling
31ec4de0ee LibVT: Show the hover hand cursor when hovering over hyperlinks :^) 2020-05-09 17:04:12 +02:00
Andreas Kling
27d1e7f432 LibVT: Add "Open URL" and "Copy URL" to TerminalWidget context menu
These only show up when you right click a hyperlinked character cell.
2020-05-09 16:42:42 +02:00
Andreas Kling
f596b12a04 LibVT+Terminal: Support hyperlinks in the terminal :^)
We now support basic hyperlinking in the terminal with <OSC>;8;;URL<ST>
Links are opened via LaunchServer on Ctrl+LeftMouse.
2020-05-09 16:16:16 +02:00
Andreas Kling
b65ca3b944 LibVT: Make Terminal::Line non-copyable and non-movable 2020-05-09 13:20:01 +02:00
Andreas Kling
a0616d96bf LibVT: Make the Xterm/OSC sequence parsing a bit more robust
Tolerate sequences ending in both <0x07> (BEL) and <0x1b> <0x5c> (ST).
The former is apparently an Xterm extension and the latter is standard.
2020-05-09 12:08:41 +02:00
Andreas Kling
283bd1a95c LibVT: Respond to DSR 0 (device status)
Also emit query responses in a single write() syscall instead of going
character-at-a-time.
2020-05-09 12:02:22 +02:00
AnotherTest
54d400c685 LibVT: Handle ctrl+arrow keys
Prior to this commit, we would treat them the same.
2020-04-20 20:23:26 +02:00
Andreas Kling
17b8857dc0 LibVT: Shift+Tab should generate ESC[Z
Fixes #1751.
2020-04-11 21:09:47 +02:00
AnotherTest
2663739db1 LibVT: Implement Device Status Report (cursor position report) 2020-04-10 00:58:59 +02:00
Andreas Kling
5c779c124b LibVT: Don't scroll-to-bottom when pressing the Logo key
Let's treat the Logo key like all the other modifiers and not scroll to
the bottom of the buffer.
2020-03-30 13:15:47 +02:00
Andreas Kling
37fc6c117c Userspace: Add missing #includes now that AK/StdLibExtras.h is smaller 2020-03-08 13:06:51 +01:00
rhin123
72ef3e529a TerminalWidget: Implement ALT selection
When holding ALT & selecting text, the terminal now forms a rectangle
selection similar to other terminal behaviors.
2020-03-06 20:20:02 +01:00
Andreas Kling
ceec1a7d38 AK: Make Vector use size_t for its size and capacity 2020-02-25 14:52:35 +01:00
Andreas Kling
bfd86c4631 LibGUI: Make GUI::Frame have the 2px sunken container look by default
The overwhelming majority of GUI::Frame users set the same appearance,
so let's just make it the default.
2020-02-23 11:10:52 +01:00
Andreas Kling
3d20da9ee4 Userspace: Use Core::Object::add() when building interfaces 2020-02-23 11:10:52 +01:00
Andreas Kling
2143da6434 LibGUI: Add forwarding header
This patch adds <LibGUI/Forward.h> and uses it a bunch.
It also dragged various header dependency reduction changes into it.
2020-02-16 09:41:56 +01:00
Andreas Kling
66903ad987 LibGfx: Remove Utf8View.h dependency from Font.h 2020-02-15 00:27:50 +01:00
Andreas Kling
e1ff4fa034 LibGUI: Remove more header dependencies from Widget.h 2020-02-15 00:24:14 +01:00
Andreas Kling
814d59f462 LibGUI: Port the drag&drop code to Core::MimeData 2020-02-14 13:18:59 +01:00
Andreas Kling
6a9cc66b97 LibGUI: Remove leading G from filenames 2020-02-06 20:33:02 +01:00
Andreas Kling
d17e23bd27 LibCore: Remove leading C from filenames 2020-02-06 15:04:03 +01:00
Andreas Kling
f8b00aa290 LibGfx: Unpublish Gfx::Size from the global namespace 2020-02-06 13:32:14 +01:00
Andreas Kling
20cfd2a6bf LibGfx: Unpublish Gfx::Rect from global namespace 2020-02-06 13:02:38 +01:00
Andreas Kling
c39d44fc2e LibGfx: Rename GraphicsBitmap.{cpp,h} => Bitmap.{cpp,h} 2020-02-06 12:07:05 +01:00
Andreas Kling
9ac94d393e LibGfx: Rename from LibDraw :^) 2020-02-06 12:04:00 +01:00
Andreas Kling
11580babbf LibDraw: Put all classes in the Gfx namespace
I started adding things to a Draw namespace, but it somehow felt really
wrong seeing Draw::Rect and Draw::Bitmap, etc. So instead, let's rename
the library to LibGfx. :^)
2020-02-06 11:56:38 +01:00
Andreas Kling
c5bd9d4ed1 LibGUI: Put all classes in the GUI namespace and remove the leading G
This took me a moment. Welcome to the new world of GUI::Widget! :^)
2020-02-02 15:15:33 +01:00
Andreas Kling
2d39da5405 LibCore: Put all classes in the Core namespace and remove the leading C
I've been wanting to do this for a long time. It's time we start being
consistent about how this stuff works.

The new convention is:

- "LibFoo" is a userspace library that provides the "Foo" namespace.

That's it :^) This was pretty tedious to convert and I didn't even
start on LibGUI yet. But it's coming up next.
2020-02-02 15:15:30 +01:00