Commit graph

125 commits

Author SHA1 Message Date
Sergey Bugaev
1671e1ac92 WindowServer+LibVT: Convert some dbgprintf() to dbg()
These kept annoying me, because these were the only two lines in the default
boot log that went unattributed.
2020-08-18 17:19:52 +02:00
Andreas Kling
75b8f4e4e6 LibGUI: Make focus events more aware of why focus is changing
This patch adds GUI::FocusEvent which has a GUI::FocusSource.
The focus source is one of three things:

- Programmatic
- Mouse
- Keyboard

This allows receivers of focus events to implement different behaviors
depending on how they receive/lose focus.
2020-08-15 00:05:45 +02:00
Nico Weber
ce95628b7f Unicode: Try s/codepoint/code_point/g again
This time, without trailing 's'. Ran:

    git grep -l 'codepoint' | xargs sed -ie 's/codepoint/code_point/g
2020-08-05 22:33:42 +02:00
Nico Weber
19ac1f6368 Revert "Unicode: s/codepoint/code_point/g"
This reverts commit ea9ac3155d.
It replaced "codepoint" with "code_points", not "code_point".
2020-08-05 22:33:42 +02:00
Andreas Kling
ea9ac3155d Unicode: s/codepoint/code_point/g
Unicode calls them "code points" so let's follow their style.
2020-08-03 19:06:41 +02:00
Andreas Kling
226c0cfb20 LibVT: Don't scroll to bottom when pressing the right shift key 2020-07-12 14:32:39 +02:00
Tom
df54229954 LibVT: Set scrollbar page size 2020-07-09 21:56:45 +02:00
Andreas Kling
0c4b0c0312 Terminal+LibVT: Add "clear including history" action (Ctrl+Shift+K) :^)
Sometimes you just want to get rid of all your scrollback history in
the terminal, and now there's a way to do that.
2020-07-05 23:34:02 +02:00
Andreas Kling
d851863704 Userspace: Remove a bunch of unnecessary Kernel/API/KeyCode.h includes 2020-07-04 17:25:31 +02:00
Andreas Kling
11c4a28660 Kernel: Move headers intended for userspace use into Kernel/API/ 2020-07-04 17:22:23 +02:00
Andreas Kling
ca93c22ae2 LibGUI: Turn GUI::Application::the() into a pointer
During app teardown, the Application object may be destroyed before
something else, and so having Application::the() return a reference was
obscuring the truth about its lifetime.

This patch makes the API more honest by returning a pointer. While
this makes call sites look a bit more sketchy, do note that the global
Application pointer only becomes null during app teardown.
2020-07-04 16:54:55 +02:00
Andreas Kling
14477eb565 Terminal: Bump the default ScrollLength to 4
This feels so much better than scrolling one line at a time. :^)
2020-06-30 18:33:09 +02:00
Benoît Lormeau
310fbe48e5 LibVT/Terminal: add a scroll length to the TerminalWidget
The scroll length is the number of lines by which the terminal will go
up/down when scrolling the mouse wheel once.
2020-06-30 18:24:00 +02:00
AnotherTest
d1d01897a3 Terminal: Ignore cell background when visual beep is active
Fixes #2621
2020-06-25 10:57:58 +02:00
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