Commit graph

127 commits

Author SHA1 Message Date
Simon Wanner
206d6ece55 LibGfx: Move other font-related files to LibGfx/Font/ 2022-04-09 23:48:18 +02:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Ben Wiederhake
d13283f952 LibVT: Fix tooltip condition, properly reset when tooltip not available 2022-03-25 02:33:23 +01:00
Brian Gianforcaro
0998074230 LIbVT: Fix copy paste regression I introduced in #13102
I accidentally inverted this behavior in commit 2042d909972

Previously it read:
```cpp
constexpr bool is_untouched() const { return !(flags & Touched); }
```
2022-03-20 21:50:58 +01:00
Brian Gianforcaro
913374163c LibVT/Kernel: Make VT::Attribute::Flags enum class, use AK EnumBits
Noticed the TODO in `Attribute.h` and realized we have as solution
to this problem already. :^)
2022-03-18 11:29:43 +01:00
Lenny Maiorani
8b334248e4 Libraries: Use default constructors/destructors in LibVT
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-13 22:34:38 +01:00
MacDue
8fbe96af45 LibVT: Use coarse scrolling animation in TerminalWidget
The smooth scrolling looks slightly off in the terminal as the
scrollbar animation lasts longer than the actual scroll.

This behaviour is also consistent with other terminal emulators.
2022-03-13 11:45:07 +01:00
MacDue
8b2025d8fc LibVT: Fix crash from integer overflow in text wrapping
Fixes #12786
2022-02-28 10:29:48 +01:00
networkException
3052c0578c LibVT: Properly populate context menu with open actions
We would previously overwrite m_hovered_href with tooltip texts instead
of leaving it as an url as was expected by the context menu event
handler.
2022-02-17 11:56:38 +01:00
Sam Atkins
8260135d4d LibCore+Everywhere: Return ErrorOr from ConfigFile factory methods
I've attempted to handle the errors gracefully where it was clear how to
do so, and simple, but a lot of this was just adding
`release_value_but_fixme_should_propagate_errors()` in places.
2022-02-16 19:49:41 -05:00
Idan Horowitz
c73ef87fc7 Kernel+LibELF+LibVT: Remove unused AK::String header includes 2022-02-16 22:21:37 +01:00
Idan Horowitz
ccad3d5a39 LibVT: Use StringBuilder::string_view() instead of to_string()
This let's us avoid a heap allocation.
2022-02-16 22:21:37 +01:00
Idan Horowitz
5b572393a9 LibVT: Use NNOP<KString> to store window titles in the Kernel
This will allow us to eventually propagate allocation failure.
2022-02-16 22:21:37 +01:00
Idan Horowitz
727fbca1a6 LibVT: Use StringBuilder's inline capacity instead of temporary Strings
This let's us avoid heap allocations.
2022-02-16 22:21:37 +01:00
brapru
93496af02b LibVT: Fix triple click behavior
When triple clicking a line in the terminal the selection will span the
whole line. However, after dragging down to lines above/below the
selection will stop at the cursor.

Instead, the expected functionality of triple clicking and dragging is
to select the whole line and any whole lines dragged to after the triple
click.

Previously, the triple line counter would get reset as soon as the whole
line was selected. This patch resets the m_triple_click_timer in the
mouse up event, so that the triple click selecting functionality is
maintained during the entire click event and terminated when the event
is over.
2022-02-13 23:05:39 +01:00
Dmitry Petrov
1662213737 Userland: Add horizontal mouse scroll support 2022-01-20 10:37:52 +01:00
Matt Jacobson
87630c5fd5 LibVT: Don't clip TerminalWidget's drawing to avoid scroller
The scroller might be hidden or (in theory) non-opaque.
2022-01-15 19:47:53 -08:00
Brian Gianforcaro
0e26ba59f7 LibVT: Enable caller to control the visibility of the scrollbar widget
In preparation for another feature, expose an API so that any users of
this widget can control the scrollbar visibility.
2022-01-15 11:03:23 +01:00
Brian Gianforcaro
538986c991 Kernel+LibVT: Use MUST + try_prepend / try_append
In preparation for making Vector::append + Vector::prepend
unavailable during compilation of the Kernel.

This specific file is compiled into the Kernel as well as LibVT.
2022-01-05 14:04:18 +01:00
Elyse
086615535f Everywhere: Use 'decrease_slider_by()' method from AbstractSlider
The same idea as 'increase_slider_by()', it helps us to avoid repeating
the pattern 'set_value(value() - delta)'.
2021-12-30 14:31:50 +01:00
Elyse
d53e1fa1fa Everywhere: Use 'increase_slider_by()' method from AbstractSlider
This method help us to avoid repeating the pattern
'set_value(value() + delta)'.
2021-12-30 14:31:50 +01:00
Daniel Bertalan
d8e383edd0 LibVT: Always clear "stomp" state when changing the cursor position
This fixes a bug, where we mistakenly put a character in the next row if
the cursor was told to move to the rightmost column when it was already
there.
2021-12-29 03:42:45 -08:00
ryanb-dev
979f300337 LibVT: Handle window resize after history overflow
Addresses an issue in which a window resize event after history
overflow would cause the Terminal to crash due to a failed assertion.

The problematic assertion was removed and the logic updated to
support inserting lines even when the start of the history is at an
offset (due to an overflow).

Resolves #10987
2021-12-28 20:28:58 +03:30
Andreas Kling
7d7950b322 LibVT: Don't leave 50ms auto-scroll timer running at all times
This timer was causing wake-ups every 50ms in all terminals, just to
right back to sleep unless we were in the middle of an auto-scroll.
2021-12-25 14:20:13 +01:00
ryanb-dev
3a6f550b24 Terminal: Fix broken selection after dbl/trp click
This commit resets the terminal triple click timer when appropriate.
2021-12-16 18:49:46 +01:00
Sam Atkins
31ea222f97 LibVT: Cast unused smart-pointer return value to void 2021-12-05 15:31:03 +01:00
Ben Wiederhake
f22c0ffe0c LibGUI+Everywhere: Make sync requests to Clipboard server more obvious 2021-11-21 11:49:06 +00:00
Ben Wiederhake
ff17f6877a LibVT: Make paste access to Clipboard atomic
This avoids data race issues and saves a synchronous request to
ClipboardServer.
2021-11-21 11:49:06 +00:00
David Lindbom
3c98a9430b LibVT: Show action of double click in tooltip
When hovering an item in Terminal we now show what application will
handle it, e.g "Open app-catdog.png in ImageViewer".

If the file is its own handler, i.e an executable, it will show
"Execute myscript.sh"
2021-11-13 23:33:46 +01:00
Andreas Kling
80d4e830a0 Everywhere: Pass AK::ReadonlyBytes by value 2021-11-11 01:27:46 +01:00
Andreas Kling
8b1108e485 Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Andreas Kling
235f39e449 LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()
This was used in a lot of places, so this patch makes liberal use of
ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-11-08 00:35:27 +01:00
Ben Wiederhake
b3e9a4e603 Libraries: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.
2021-11-02 22:56:53 +01:00
Filiph Sandström
d6a0726302 Everywhere: Rename left/right-click to primary/secondary
This resolves #10641.
2021-10-27 22:05:58 +03:00
Ben Wiederhake
fd7e8f16f2 LibVT: Add missing headers 2021-10-06 23:52:40 +01:00
Jelle Raaijmakers
49ccda5d97 LibVT: Implement G0..G3 and VT100 translation table 2021-10-02 21:07:47 +01:00
Jelle Raaijmakers
aaa1382bd6 LibVT: Implement support for Cursor Keys Mode (DECCKM) 2021-10-02 21:07:47 +01:00
Jelle Raaijmakers
e33e0e6a27 LibVT: Add stubs for DECPNM, DECPAM
Still not implemented, but provides easier to grasp FIXMEs.
2021-10-02 21:07:47 +01:00
brapru
b5f812d11d LibVT: Add movemouse support for triple click
When moving the mouse after a triple click, the selected buffer does not
maintain the whole line selection. This patch will allow triple click
highlighting to hold the whole line selection.
2021-09-19 20:28:09 +04:30
brapru
7a673f5aa3 LibVT: Keep track of the buffer postiion on mousedown events 2021-09-19 20:28:09 +04:30
Brian Gianforcaro
b9c53a096a LibVT: Use default instead of an empty constructor/destructor
Default implementations allow for more optimizations.
See: https://pvs-studio.com/en/docs/warnings/v832/
2021-09-16 17:17:13 +02:00
Musab Kılıç
7f46022e66 LibVT: Execute DragOperation after resetting active hyperlink 2021-09-02 22:48:10 +02:00
Andreas Kling
82d8cd2b87 Terminal+LibVT: Use LibConfig instead of Core::ConfigFile 2021-08-26 00:54:27 +02:00
Lenny Maiorani
a0d7640e03 Userland: Make use of container version of any_of
Problem:
- New `any_of` implementation takes the entire container so the user
  does not need to pass explicit begin/end iterators. This is unused
  except is in tests.

Solution:
- Make use of the new and more user-friendly version where possible.
2021-08-02 00:37:18 +02:00
Brian Gianforcaro
18d6f9ed5c Libraries: Remove unused header includes 2021-08-01 08:10:16 +02:00
TheFightingCatfish
0c53c2dfa2 LibGUI: Add a ClipboardClient for GUI::Clipboard
Anyone who inherits from `GUI::Clipboard::ClipboardClient` will receive
clipboard notifications via `clipboard_content_did_change()`.

Update ClipboardHistoryModel, TextEditor and TerminalWidget to inherit
from this class.
2021-07-27 23:49:25 +02:00
Andreas Kling
c7d891765c LibGfx: Use "try_" prefix for static factory functions
Also mark them as [[nodiscard]].
2021-07-21 18:02:15 +02:00
Hendiadyoin1
ed46d52252 Everywhere: Use AK/Math.h if applicable
AK's version should see better inlining behaviors, than the LibM one.
We avoid mixed usage for now though.

Also clean up some stale math includes and improper floatingpoint usage.
2021-07-19 16:34:21 +04:30
Andreas Kling
234d53a324 Terminal: Put debug spam in unimplemented_control_code() behind a flag 2021-07-10 16:13:34 +02:00
Daniel Bertalan
05c174b45a LibVT: Reset scrollbar after switching to/from the alternate buffer
We did not call the history change callback after switching to the
alternate screen buffer, which caused the scrollbar to not change its
maximum value. If we already had lines in the scrollback buffer, this
meant that we could drag the scrollbar, which then tried to access
non-existent lines from the scrollback.

Fixes #8581
2021-07-10 01:23:23 +02:00