Commit Graph

3901 Commits

Author SHA1 Message Date
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
Conrad Pankoff
4afe9e4f2a Kernel: Implement rtl8139 network interface driver 2019-08-21 17:10:34 +02:00
Conrad Pankoff
286bafbb19 Kernel: Implement link status in /proc/net/adapters 2019-08-21 17:10:34 +02:00
Andreas Kling
af840af1ce Documentation: Let's have a coding style document
This is only meant to be about higher-level coding style, not the small
things like brace placement, indentation, etc. For all of that we just
obey clang-format.
2019-08-21 17:01:29 +02:00
Conrad Pankoff
bcd214c29d Userland: Fix ifconfig use of /proc/net/adapters 2019-08-21 16:57:31 +02:00
Andreas Kling
de87258b4f Userland: Remove immature "tc" and "uc" programs in favor of "nc"
The netcat-lite "nc" utility is where we should put all of the various
"lightweight" TCP/UDP client features.
2019-08-21 16:49:11 +02:00
Andreas Kling
5de483cfbb Kernel: Move DiskDevice::block_size() up to BlockDevice
All block devices should have a block size, after all. This defaults to
PAGE_SIZE if no size is specified.
2019-08-21 16:48:59 +02:00
Rok Povsic
52366e3f02 Meta: Update ReadMe with GCC 8 requirement 2019-08-21 11:50:40 +02:00
Andreas Kling
9731bff44c ls: Sort the output alphabetically
Also use StringBuilder to construct the full relative paths, to get rid
of an unnecessary and suspicious-looking buffer.
2019-08-20 21:39:01 +02:00
Andreas Kling
029786e6b5 ls: Don't layout or colorize output if stdout is not a TTY 2019-08-20 21:06:44 +02:00
marprok
d4b7b92492 Userland: ls division by zero.
When the terminal app window became smaller than the longest filename,
a division by zero occured while calculating the offset.
2019-08-20 20:17:10 +02:00
Andreas Kling
c106ec4719 Terminal: Allow scrolling through terminal history with the mouse wheel
Fixes #470.
2019-08-20 20:12:31 +02:00
Andreas Kling
dc3c6be6f2 GScrollBar: Allow scrolling the scrollbar by mouse-wheeling over it 2019-08-20 20:11:20 +02:00
Andreas Kling
076827a05d GModel: Rename on_model_update(GModel&) => on_update()
Just simplifying the API of this hook a little bit.
2019-08-20 19:45:08 +02:00
Andreas Kling
f7dce05c82 LibGUI: Remove confusing GModelNotification concept
This was a bad idea and it didn't stick. Instead we should just use the
simple "on_foo" hook functions like we do for everything else. :^)
2019-08-20 19:44:02 +02:00
Andreas Kling
4f3234148a Inspector: Show remote object properties in a table view
This patch expands the object model of this program quite a bit.
We now have a RemoteProcess object that contains a list of remote root
RemoteObject objects.

The RemoteProcess vends a RemoteObjectGraphModel&, and indices in that
model have internal_data() pointing to a corresponding RemoteObject.
RemoteObjects in turn vend a RemoteObjectPropertyModel&, which is what
we use to show the object properties.

This is pretty cool :^)
2019-08-19 20:29:52 +02:00
Andreas Kling
736dc5f6c0 Inspector: Add a missing "override" in RemoteObjectGraphModel 2019-08-19 19:46:40 +02:00
Andreas Kling
64f16c141d Terminal: Implement basic history scrollback
This code needs some optimization work to reduce the amount of repaints
but the history feature basically works, which is cool :^)

Fixes #431.
2019-08-19 19:15:36 +02:00
Andreas Kling
462336ed49 LibVT: Add scrollback history to VT::Terminal
The default (hard-coded) history size is 500 lines. When the history is
altered, the TerminalClient is notified via terminal_history_changed().
2019-08-19 19:07:52 +02:00
Andreas Kling
a5cdd0afa5 NonnullPtrVector: Add ptr_at() getters for accessing the NonnullPtr
Normally you want to access the T&, but sometimes you need to grab at
the NonnullPtr, for example when moving it out of the Vector before
a call to remove(). This is generally a weird pattern, but I don't have
a better solution at the moment.
2019-08-19 19:04:52 +02:00
Andreas Kling
179158bc97 Kernel: Put debug spam about already-paged-in inode pages behind #ifdef 2019-08-19 17:30:36 +02:00
Andreas Kling
6cd9c020ea LibC: Write to the dbg() every time we perror() in userspace
There's a high chance that we're interested in whatever errors come out
of perror(), so let's output those on the debugger as well.
2019-08-19 17:25:49 +02:00
Marios Prokopakis
91c79440a1 Userland: Improved the printing of the ls command. (#468)
The ls command takes into consideration the length of the largest
filename when it prints a line.

Fixes #432.
2019-08-19 16:37:21 +02:00
Andreas Kling
3792c91059 LibGUI: Implement save_to(JsonObject&) for GWindow and GWidget 2019-08-19 16:34:53 +02:00
Andreas Kling
c2213449c0 LibCore: Move CObject serialization into CObject::save_to(JsonObject&)
The idea is for subclasses to override this and add whatever properties
are relevant for them, then call up to their base class, etc.
2019-08-19 16:34:53 +02:00