Commit graph

111 commits

Author SHA1 Message Date
Hüseyin ASLITÜRK
7abca30f41 LibVT: Replace u8 type to u32 for code point
Replace KeyEvent text attribute usage with code_point.
2020-06-16 13:15:17 +02:00
Andreas Kling
fdfda6dec2 AK: Make string-to-number conversion helpers return Optional
Get rid of the weird old signature:

- int StringType::to_int(bool& ok) const

And replace it with sensible new signature:

- Optional<int> StringType::to_int() const
2020-06-12 21:28:55 +02:00
Andreas Kling
116cf92156 LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSize
This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much
better visual clue about what type of metric is being used.
2020-06-10 10:59:04 +02:00
Andreas Kling
165f69023b LibVT: Allow updating the window progress via an escape sequence
You can now request an update of the terminal's window progress by
sending this escape sequence:

<esc>]9;<value>;<max_value>;<escape><backslash>

I'm sure we can find many interesting uses for this! :^)
2020-05-30 23:00:35 +02:00
Sergey Bugaev
66c6e0035e LibVT: Fix emitting \0 when pressing a modifier key
This causes the kernel to return EOF, which in turn confuses everything. This is
a regression from the LibVT port of VirtualConsole.
2020-05-30 15:01:18 +02:00
Sergey Bugaev
620697d924 LibVT: Move most of key press handling logic into VT::Terminal
This will let us share it between the userspace (TerminalWidget) and the Kernel.
2020-05-27 11:19:38 +02:00
Sergey Bugaev
602c3fdb3a AK: Rename FileSystemPath -> LexicalPath
And move canonicalized_path() to a static method on LexicalPath.

This is to make it clear that FileSystemPath/canonicalized_path() only
perform *lexical* canonicalization.
2020-05-26 14:35:10 +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
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