Commit Graph

4225 Commits

Author SHA1 Message Date
Andreas Kling
9f99e285d1 Utf8View: Don't print potentially unterminated string in debug message 2019-09-15 15:46:40 +02:00
Jesse Buhagiar
ecdaf991c6 Shell: Added pushd, popd and dirs builtins
Added a few builtin functions to the shell to make navigating a bit
easier in the terminal.

`pushd` allows a user to "push" the current directory to the directory
stack, and then `cd` to the new directory.
`popd` allows the used to take the directory on the top of the stack
off before `cd`'ing to it.
`dirs` gives the state of the current directory stack.

This is only a partial implementation of the `bash` version
(gnu.org/software/bash/manual/html_node/Directory-Stack-Builtins.html)
, and doesn't include any of the +N or -N commands as of yet.
2019-09-15 14:16:40 +02:00
Andreas Kling
85d629103d Kernel: Implement shebang executables ("#!/bin/sh")
This patch makes it possible to *run* text files that start with the
characters "#!" followed by an interpreter.

I've tested this with both the Serenity built-in shell and the Bash
shell, and it works as expected. :^)
2019-09-15 11:47:21 +02:00
Andreas Kling
d754ac5bcb LibGUI+VisualBuilder: Add move-to-front/back to GCommonActions
Also give them nice little icons. :^)
2019-09-14 22:42:39 +02:00
Andreas Kling
92b17eab23 VisualBuilder: Use GCommonActions::make_delete_action() 2019-09-14 22:32:56 +02:00
Andreas Kling
b41b5433f4 LibGUI: Add Undo/Redo to GCommonActions 2019-09-14 22:23:49 +02:00
Andreas Kling
e83390387c LibGUI: Simplify GCommonActions a bit
Use the same callback signature as GAction so we can just forward it
to GAction instead of chaining callbacks.
2019-09-14 22:10:44 +02:00
Andreas Kling
b7bedab28a Shell: Support extremely naive shell script execution
This patch allows passing a script as an argument to the Shell program.
We will read the specified line by line and pass them through the Shell
command interpreter.

This is not very powerful, but it's a start :^)
2019-09-14 21:20:13 +02:00
Andreas Kling
e1481dcb42 Kernel: Stop idling after handling an IRQ
If we receive an IRQ while the idle task is running, prevent it from
re-halting the CPU after the IRQ handler returns.

Instead have the idle task yield to the scheduler, so we can see if
the IRQ has unblocked something.
2019-09-14 20:21:10 +02:00
Andreas Kling
b35ad5b523 Kernel: Fix bad assertion in Lock::unlock_if_locked()
We shouldn't assert if you call this on a Lock held by another Thread
in the same Process. Instead, we should just not unlock.
2019-09-14 20:21:06 +02:00
Jesse Buhagiar
58ceaebd5a DisplayProperties: Wallpaper tab now has preview
As was mentioned in #556, the `DisplayProperties` Wallpaper tab
contained a lot of "extra space", in which half the tab was taken up
by the list of wallpapers. The rest of that space is now reserved for
a wallpaper preview, so the user can see the selected image before
applying it.
2019-09-14 19:27:16 +02:00
Aaron Malpas
f44e7dc5d0 Shell: Add POSIX-compliant character escaping
POSIX.1-2017, Shells & Utilities, section 2.2
2019-09-14 12:45:01 +02:00
Mauri de Souza Nunes
2d24b12a34 LibC: Implement mkdtemp library function 2019-09-14 12:05:50 +02:00
Andreas Kling
161cb89e87 LibC: Make gettid() cache the thread ID in thread-local-storage
This makes gettid() very cheap, compared to the cost of having to do
a syscall every time.
2019-09-14 11:37:58 +02:00
Andreas Kling
ec5091fa7d GraphicsBitmap: Allow constructing a wrapper bitmap around 8-bit pixels
This will be very useful for optimizing games like DOOM. :^)
2019-09-14 11:20:07 +02:00
Andreas Kling
813deaed45 Ports: Remove now-unnecessary DOOM patch
Now that we're building our own DOOM fork, we don't need any patches.
2019-09-14 10:55:18 +02:00
Andreas Kling
24cc61aae2 Ports: Point doom port to our own SerenityDOOM fork
This will make it easier to make improvements to the port.
2019-09-14 10:05:02 +02:00
Andreas Kling
31046b18bb FileManager: Use a special clipboard data type for copied file lists
When copying a list of files to the clipboard, we now use the special
data type "file-list".

This allows us to have the paste action's enabled state reflect the
actual ability to paste something. :^)
2019-09-14 09:20:20 +02:00
Andreas Kling
c543ee5c5b WindowServer+LibGUI: Store a "data type" with the clipboard content
This will allow us to distinguish between different types of data
stored on the clipboard.
2019-09-14 09:19:05 +02:00
Andreas Kling
9d2c4d223a TextEditor+Base: Add an icon for the "Find" action :^) 2019-09-13 23:56:37 +02:00
Andreas Kling
ff72b4d475 FileManager+Base: Add "properties" icon
Something to show for the properties action in FileManager. It still
doesn't actually do anything, but at least now it looks neat. :^)
2019-09-13 23:07:59 +02:00
Andreas Kling
414b0f4f9e Base: Add a 16x16 icon for sound files 2019-09-13 22:39:39 +02:00
Andreas Kling
11f2e7cd5c GMenu: Update apps now that you can create a nameless GMenu
We had many context menus with names, simply because you were forced
to give them names.
2019-09-13 22:14:07 +02:00
Andreas Kling
5eb2c138e2 FileManager: Update enabled state of the copy and delete actions
Based on whether something is selected or not. I added a FIXME about
the paste action, since that will require some more coordination with
the system clipboard.
2019-09-13 22:09:01 +02:00
Andreas Kling
27e1128e6e FileManager: Assign keyboard shortcuts to the various actions 2019-09-13 22:04:08 +02:00
Andreas Kling
3a02bd40f8 FileManager: Add a basic context menu with copy/paste/delete/...
I also added a dummy "Properties..." action just to fill out the menu a
little bit. :^)

Fixes #270.
2019-09-13 22:00:47 +02:00
Andreas Kling
f360858836 LibGUI: Tweak selection modification behavior on context menu event
Before bringing up the context menu, clicking...

- ...on an already selected item leaves selection alone
- ...on an unselected item makes it the only selected item
- ...outside any item clears the selection
2019-09-13 21:58:30 +02:00
Andreas Kling
f1c4b65089 GDirectoryModel: Add on_path_change hook 2019-09-13 21:43:23 +02:00
Andreas Kling
bf23f1e8bc GItemView: Add context menu support
Also, use the model_column() internally for selection as well as for
painting to keep things consistent.

Note that we always fire the on_context_menu_request hook, even if you
didn't click on an item. In those cases, you get a GModelIndex().
2019-09-13 21:42:26 +02:00
Andreas Kling
69365ccdd0 GMenu: Allow constructing without a name
We'll just default to "", which works fine for context menus.
2019-09-13 21:29:47 +02:00
Drew Stratford
45ded86bcb Kernel: Move fchdir to end of enumerate syscalls.
The introduction fchdir in the middle of the EUMERATE_SYSCALLS
expression changed other syscall numbers, which broke compatibility.
This commit fixes that by moving it to the end.
2019-09-13 16:30:22 +02:00
Tim Morgan
af6948afe0 Shell: fix crash when using cd - and OLDPWD is null 2019-09-13 15:12:16 +02:00
Andreas Kling
3d4935a223 Emoji: Add some simple emojis I drew on the train
We're gonna need a lot more of these, and I don't know if the size is
quite right, but here's a start. :^)
2019-09-13 14:44:45 +02:00
Andreas Kling
09e89cc55d Revert "AK: Made Strings reversible"
This reverts commit 26e81ad574.

We forgot to consider UTF-8 here. String is UTF-8 and we need to be
careful about things like this.
2019-09-13 14:37:25 +02:00
Andreas Kling
2d1f3ec749 Kernel: fchdir() should fail for non-searchable directories
So sayeth POSIX.
2019-09-13 14:35:18 +02:00
Mauri de Souza Nunes
7d85fc00e4 Kernel: Implement fchdir syscall
The fchdir() function is equivalent to chdir() except that the
directory that is to be the new current working directory is
specified by a file descriptor.
2019-09-13 14:04:38 +02:00
Jesse Buhagiar
26e81ad574 AK: Made Strings reversible
`AK::String` can now be reversed via AK::String::reverse(). This makes
life a lot easier for functions like `itoa()`, where the output
ends up being backwards. Very much not like the normal STL
(which requires an `std::reverse` object) way of doing things.

A call to reverse returns a new `AK::String` so as to not upset any
of the possible references to the same `StringImpl` shared between
Strings.
2019-09-13 13:54:07 +02:00
Tim Morgan
093961d2d9 Shell: Remember previous working dir
...and allow switching back to it with `cd -`

Partially addresses #397
2019-09-13 10:48:04 +02:00
MinusGix
ad75b61eca IRCClient: Fix unneeded conversion to String 2019-09-13 09:22:30 +02:00
MinusGix
a574e1ab84 TestStringView: Add test for starts_with 2019-09-13 09:22:30 +02:00
MinusGix
05f641a5a9 StringView: Add starts_with method 2019-09-13 09:22:30 +02:00
Mauri de Souza Nunes
6d7c928359 LibC: Add MAXPATHLEN to limits.h
MAXPATHLEN defines the longest permissable path length after expanding
symbolic links. It is used to allocate a temporary buffer from the buffer
pool in which to do the name expansion, hence should be a power of two.

On UNIX MAXPATHLEN has the same size as PATH_MAX.
2019-09-13 09:21:41 +02:00
Andreas Kling
c74e4d0c80 LibC: Pass the environment as third argument to main()
After some very confused debugging, I discovered that GNU make has a
main() function with this signature:

    int main(int argc, char** argv, char** envp)

Apparently this is a non-standard but widely supported thing, so let's
do the same in Serenity so make works as expected.

This fixes an issue where you had to do "make PATH=..." instead of make
just picking up PATH from the environment. :^)
2019-09-12 21:43:32 +02:00
Andreas Kling
27321e9c44 PaintBrush: Only send left and right mouse button events to tools
Tools don't know what to do with the middle mouse button anyway,
so it's better if we just don't pass it along.

Fixes #546.
2019-09-12 20:33:05 +02:00
Andreas Kling
d86fb8033e FileManager: Show info about currently selected items in statusbar
When there's a non-zero number of selected items, we now show the
number in the statusbar, along with the total selected file size. :^)

Fixes #271.
2019-09-12 18:59:13 +02:00
Andreas Kling
13ca1ee8dc GDirectoryModel: Allow retrieving an item's full path via Role::Custom 2019-09-12 18:58:52 +02:00
Andreas Kling
1cb661ae69 GModelSelection: Add size() and a const overload of for_each_index() 2019-09-12 18:42:15 +02:00
Andreas Kling
566eb58170 GDirectoryModel: Include directories in total byte count
I don't know what's really right or wrong here. It seems fine to also
include the directories in the total byte count, and it makes it a bit
easier to stay consistent when adding up size numbers elsewhere.
2019-09-12 18:41:28 +02:00
Andreas Kling
1632f6b2dd FileManager: Add C_OBJECT macro to DirectoryView 2019-09-12 18:26:26 +02:00
Andreas Kling
aeba1128e3 LibC: Add some missing errno codes 2019-09-12 18:26:19 +02:00