Commit Graph

3925 Commits

Author SHA1 Message Date
rhin123
0df7213670 Terminal: Fixed bounding issue when clearing the selection on type
We were checking the columns of the whole selection instead of the
the specfic line were modifying. Because of this, the selection
remained if the selection's column on another line was less than
the cursor.
2019-08-25 19:53:57 +02:00
Rok Povsic
eb9ccf1c0a FileSystem: Add FIXME about resolve_path bug 2019-08-25 19:47:37 +02:00
Rok Povsic
e36b9635df Userland: Add realpath 2019-08-25 19:47:37 +02:00
Rok Povsic
2ca8158a73 LibC: Add realpath 2019-08-25 19:47:37 +02:00
Rok Povsic
18fbe4ac83 Kernel: Add realpath syscall 2019-08-25 19:47:37 +02:00
Andreas Kling
8f50d75184 AK: Make HashTable.h compile inside the SDL2 port 2019-08-25 17:47:48 +02:00
Andreas Kling
9bc3444626 LibDraw: Fix wrong installation path 2019-08-25 17:42:16 +02:00
Andreas Kling
11896d0e26 Kernel: Avoid a memcpy() of the whole block when paging in from inode 2019-08-25 14:34:53 +02:00
Andreas Kling
fa20dcafb5 GTextEditor: Simplify computation of visual selection start/end
Add Line::visual_line_containing(int column) to easily convert a column
number into a visual line index.
2019-08-25 14:04:46 +02:00
Andreas Kling
97a695403b TextEditor: Add a menu action for turning line-wrapping on/off 2019-08-25 12:23:34 +02:00
Andreas Kling
5aac652b4b GTextEditor: Relayout when the line-wrapping setting is changed 2019-08-25 12:23:14 +02:00
Andreas Kling
453ca65a96 Ports/ncurses: Unbreak patch so we can build with latest ncurses master
Maybe we should build a specific version of ncurses instead but this at
least makes it work again for now.
2019-08-25 11:43:48 +02:00
Andreas Kling
e0b4f14eb8 Meta: Add funding links to get a "Sponsor" button on GitHub 2019-08-25 11:41:30 +02:00
Andreas Kling
64617f56ed Meta: Add note about the first line of commit messages to contrib guide 2019-08-25 11:24:23 +02:00
Andreas Kling
3ca1c72c77 GTextEditor: Unbreak selection painting in the new line-wrapping world
To expand a bit on how the line-wrapping works, each physical line of
text is broken up into multiple visual lines. This is recomputed when
the document changes, or when the widget is resized.

Each GTextEditor::Line keeps track of the visual breaking points, and
also their visual rect in content coordinates. This allows us to do
painting and hit testing reasonably efficiently for now.

This code needs some cleanup, but it's finally in a working state, so
here it goes. :^)
2019-08-25 11:24:23 +02:00
Andreas Kling
7b5bcec562 GTextEditor: Fix computing content x/rect values with line wrapping
This makes the cursor actually get painted on the right visual line
when in line-wrapping mode.
2019-08-25 11:24:23 +02:00
Andreas Kling
2e31b6627e GTextEditor: Take horizontal padding into account for line visual rects 2019-08-25 11:24:23 +02:00
Andreas Kling
9752e683f6 GTextEditor: Start working on a line-wrapping feature
This is not finished, but since the feature is controlled by a runtime
flag, the broken implementation should not affect users of this widget
too much (in theory :^).)
2019-08-25 11:24:23 +02:00
rhin123
280a9a2f34 Terminal: Clear selection if we type behind/inside it 2019-08-25 10:44:31 +02:00
Andreas Kling
23b70d5c59 GTextEditor: Clean up some of the rect computations
Moving some rect computations to separate functions to make it easier
to reuse them.
2019-08-25 07:17:09 +02:00
Andreas Kling
ac7a559d96 Ext2FS: Avoid a String allocation in lookup()
By using find() with a custom finder, we can avoid creating a temporary
key value that's only used for the hash lookup.
2019-08-25 06:45:37 +02:00
Andreas Kling
d38bd3935b AK: Add StringView::hash()
This grabs the hash from the underlying StringImpl if there is one,
otherwise it's computed on the fly.
2019-08-25 06:45:31 +02:00
Andreas Kling
bb32fd8bfa AK: Add HashMap::find() with customizable finder callback
This will allow clients to search the map without having to instantiate
a key value.
2019-08-25 06:45:27 +02:00
Andreas Kling
cd8278e489 AK: Add String::operator==(StringView)
Comparing a String to a StringView would instantiate a temporary
String just for the comparison. Let's not do that. :^)
2019-08-25 06:45:19 +02:00
Andreas Kling
b020a5e7ce Kernel: Don't create a String every time we look up a Custody by name 2019-08-25 06:45:14 +02:00
Andreas Kling
a00419ed77 AK: Optional::operator bool() should consume the Optional
We use consumable annotations to catch bugs where you get the .value()
of an Optional before verifying that it's okay.

The bug here was that only has_value() would set the consumed state,
even though operator bool() does the same job.
2019-08-25 06:45:09 +02:00
Andrew Weller
e75e33eb46 TextEditor: Replaced 'Find' button with 'Prev' and 'Next' buttons. 2019-08-24 21:57:42 +02:00
Andreas Kling
952baf32cd TmpFS: Notify any associated InodeVMObject on inode changes 2019-08-24 19:59:01 +02:00
Andreas Kling
5978993f00 TmpFS: Fix two bugs that broke GCC inside Serenity
- TmpFSInode::write_bytes() needs to allow non-zero offsets
- TmpFSInode::read_bytes() wasn't respecting the offset

GCC puts the temporary files generated during compilation in /tmp,
so this exposed some bugs in TmpFS.
2019-08-24 19:58:09 +02:00
Andreas Kling
b018cd653f Kernel: Fix oversized InodeVMObject after inode size changes 2019-08-24 19:35:47 +02:00
Andreas Kling
9bd68b189e KBuffer: capacity() should return internal capacity, not internal size
KBuffer is just meant to be a dumb wrapper around KBufferImpl.
With this change, we actually start to see KBuffers with different size
and capacity, which allows some reallocation-avoiding optimizations.
2019-08-24 18:33:22 +02:00
Andreas Kling
11f88a78ad Userland: Remove unnecessary output from "rm" 2019-08-24 13:34:52 +02:00
Andreas Kling
d3a8fe70a2 LibC: Fix strtol() handling of invalid characters
Rewrite this function to go from left-to-right instead of right-to-left
since this allows us to accumulate valid characters before encountering
any invalid ones.

This fixes parsing of strings emitted by GCC, like "1, %0|%0, %1}". :^)
2019-08-24 12:37:58 +02:00
Andreas Kling
56eaf9b033 AK: Make FileSystemPath better at handling relative paths
Relative paths now canonicalize into a string starting with "./"
Previously, "foo" would be canonicalized as "/foo" which was clearly
not right.
2019-08-23 19:58:16 +02:00
Andreas Kling
b1bc7a1b5d TextEditor: Don't try to load contents of files we didn't even open
If the CFile::open() call fails, we shouldn't continue with trying to
load the file.
2019-08-23 19:11:56 +02:00
Andreas Kling
d56786ccd8 TextEditor: Avoid an unnecessary whole-file copy when opening something
This was left over from before we had the StringView(const ByteBuffer&)
constructor to help us.
2019-08-23 19:05:34 +02:00
Andreas Kling
5768b384b9 Kernel: Give each TTY 1 KB of input buffer
This papers over an immediate issue where pseudoterminals would choke
on more than 16 characters of pasted input in the GUI terminal.

Longer-term we should find a more elegant solution than using a static
size CircularQueue for this.
2019-08-23 18:55:33 +02:00
Andreas Kling
32810a920f Kernel: Implement kill(0, signal)
This sends the signal to everyone in the same process group as the
calling process.
2019-08-23 18:28:59 +02:00
Andreas Kling
06de0e670c Kernel: Use IteratorDecision in Process::for_each_in_pgrp() 2019-08-23 18:28:59 +02:00
Andreas Kling
748b38d80f GTextEditor: Fix obvious bug in find()
We forgot to rewind the search cursor after a partial match, which
would make us fail to find "xxy" in "xxxxy".
2019-08-23 13:54:25 +02:00
Andreas Kling
1ca6adee90 Terminal: Allow selecting words by double-clicking them
Bonus feature: also allow selecting the whitespace in-between words by
double-clicking that. :^)
2019-08-22 19:59:27 +02:00
Andreas Kling
fae379b1f0 TextEditor: Search box should find on return, close itself on escape
This patch adds basic keyboard access to the search box. We also yield
focus back gracefully to the text document when the search box is no
longer wanted.

Focus should probably move automatically when an ancestor of the
currently focused widget if made invisible..
2019-08-22 11:11:48 +02:00
Andreas Kling
96c5c9ce12 TextEditor: Hide the search bar until the user asks for it
You can get to it via Edit/Find, or by pressing Ctrl+F.
2019-08-22 11:02:03 +02:00
Andreas Kling
933a98f8fa Kernel: Make Lock::lock() assert early that we're not in the scheduler
The scheduler is not allowed to take locks, so if that's happening,
we want to make that clear instead of crashing with the more general
"Interrupts disabled while trying to take Lock" error.
2019-08-22 09:22:30 +02:00
Andreas Kling
bb74832dd6 TextEditor: Add a search bar that allows you to search for text
If the text is not found, we show a friendly message box that says we
didn't find the text! :^)
2019-08-21 21:30:20 +02:00
Andreas Kling
0c72371ad9 GTextEditor: Implement a simple text search API
- GTextRange find(const StringView& needle, const GTextPosition& start)

This function searches for the needle in the haystack (the full text)
and returns a GTextRange for the closest match after "start".
If the needle is not found, it returns an invalid GTextRange.
If no "start" position is provided, the search begins at the head of
the text document. :^)
2019-08-21 21:23:17 +02:00
Andreas Kling
5670a3e064 GTextEditor: Run clang-format on GTextEditor.cpp 2019-08-21 20:20:07 +02:00
Andreas Kling
d5431a6df8 GTextEditor: Rename is_automatic_indentation_enabled() API
The previous name was is_automatic_indentation() which sounds weird.
2019-08-21 19:33:54 +02:00
Andreas Kling
9e5c5627d5 GTextEditor: Give Line objects a back-reference to the GTextEditor
This will allow us to do more complicated things in Line without having
to pass the editor around all the time.
2019-08-21 19:32:39 +02:00
Conrad Pankoff
0b3308f995 Kernel: Remove over-eager const from rtl8139 driver link_up function 2019-08-21 17:16:03 +02:00