Commit Graph

4865 Commits

Author SHA1 Message Date
balatt
b583f21e27 Userland: cat no longer tries to open "cat"
I made the mistake of starting the initial for loop at i=0 when it
should have started at 1. argv[0] is the program name, argv[1] is an
argument.
2019-10-31 06:57:41 +01:00
Andreas Kling
7c71040ba9 HackStudio: Show documentation preview in tooltip on identifier hover
When hovering over a C++ token that we have a man page for, we now show
the man page in a tooltip window.

This feels rather bulky at the moment, but the basic mechanism is quite
neat and just needs a bunch of tuning.
2019-10-30 20:28:44 +01:00
Andreas Kling
a4709502d1 GTextEditor: Make text_position_at() protected 2019-10-30 20:28:44 +01:00
Andreas Kling
bddba567b3 LibGUI: Add GTextDocument::text_in_range(GTextRange)
This function returns a String containing the text in a given range.
GTextEditor::selected_text() is now just a wrapper around this.
2019-10-30 20:28:44 +01:00
Andreas Kling
c1efa4f336 LibMarkdown: Include a <head> element when rendering MD to HTML
This should really be handled by LibHTML, but just include a <head>
element for now, so generated man pages always have a <head>.
2019-10-30 20:28:44 +01:00
Drew Stratford
058c8337df Shell: Properly set and restore termios settings.
Previously, we did not properly restore termios settings
after running built-in commands. This has been fixed
by ensuring that we only change the termios settings
when we are forking a child process.
2019-10-30 14:35:39 +01:00
Drew Stratford
378480e8e4 TTY: Properly implement echo in VirtualConsole.
VirtualConsole::echo now actually echoes characters
instead of doing nothing.
2019-10-30 14:35:39 +01:00
Liav A
ed45f67c00 Kernel: Enabling Text mode debugging (#696)
Also added an option to start Serenity with text mode in QEMU
in the run script.
2019-10-29 16:41:40 +01:00
Andreas Kling
014f8ca8c4 AK: Allow JsonValue to store 64-bit integers internally
Add dedicated internal types for Int64 and UnsignedInt64. This makes it
a bit more straightforward to work with 64-bit numbers (instead of just
implicitly storing them as doubles.)
2019-10-29 16:36:50 +01:00
balatt
5442e365c9 cat: Updated to handle multiple input files (#694)
Now concatenates multiple files at once with a for loop iterating
through a vector of file arguments.
2019-10-29 16:08:09 +01:00
Andreas Kling
fa69b9fbb7 IRCClient: Switch to using an HtmlView for the IRC window contents :^)
This seemed like a perfect fit for LibHTML. We can now style the IRC
channels and queries however we like with the power of HTML and CSS.

This patch doesn't do much in the way of styling, it just gets the
basic mechanism into place.
2019-10-28 20:53:19 +01:00
Andreas Kling
98ff8ef0cf LibHTML: Add Document::force_layout()
..for when you really need a layout to happen right now.
Also, automatically repaint the layout root after layout.
2019-10-28 20:51:45 +01:00
Andreas Kling
d24164ac6a HackStudio: Add little icons for ".cpp" and ".h" files
This makes it easier to tell them apart in locator suggestions. :^)
2019-10-28 19:08:48 +01:00
Andreas Kling
272c59e6d8 HackStudio: Remove unnecessary Locator::keydown_event() 2019-10-28 19:08:48 +01:00
Andreas Kling
990ca1a7a5 HackStudio: Allow opening a Locator suggestion by double-clicking it 2019-10-28 19:08:48 +01:00
Andreas Kling
29ac3e1477 HackStudio: Scroll the locator suggestions when navigating with arrows 2019-10-28 19:08:48 +01:00
Andreas Kling
b4de5ac128 HackStudio: Start working on a "Locator", much like Qt Creator has
Pressing Ctrl+K will now open the little locator command line at the
bottom of the window. Right now it can only be used to jump quickly
to a file.
2019-10-28 19:08:48 +01:00
Andreas Kling
f0da3ab9b2 LibGUI: Make GTextBox non-final
There's nothing wrong with subclassing GTextBox.
2019-10-28 19:08:48 +01:00
Andreas Kling
01c6088789 AK: Add String::contains(String)
This is just a wrapper around strstr() for now. There are many better
ways to search for a string within a string, but I'm just adding a nice
API at the moment. :^)
2019-10-28 19:08:48 +01:00
Andreas Kling
fe83d5087b HackStudio: Show .h files with C++ syntax highlighting 2019-10-28 19:08:48 +01:00
Karol Baraniecki
9131134704 Kernel: Support passing arguments in shebangged scripts
Add the ability to both pass arguments to scripts with shebangs
(./script argument1 argument2) and to specify them in the shebang line
(#!/usr/local/bin/bash -x -e)

Fixes #585
2019-10-28 09:22:00 +01:00
Andreas Kling
e2c74762ff HackStudio: Draw a brownish frame around the current editor widget
Also make the editor filename label bold only for the current editor.
2019-10-27 20:44:37 +01:00
Andreas Kling
e2d7f585da HackStudio: Support opening the same file in both editors
Hey, it actually works! You can now edit the same file in both editors
and even the C++ highlighting updates correctly in both of them. :^)
2019-10-27 19:39:15 +01:00
Andreas Kling
9b13a3905b LibGUI: Support multiple GTextEditors editing the same GTextDocument
With this patch, you can now assign the same GTextDocument to multiple
GTextEditor widgets via GTextEditor::set_document().

The editors have independent cursors and selection, but all changes
are shared, and immediately propagate to all editors.

This is very unoptimized and will do lots of unnecessary invalidation,
especially line re-wrapping and repainting over and over again.
2019-10-27 19:36:59 +01:00
Andreas Kling
f96c683543 LibGUI: Move visual line metadata from GTextDocument to GTextEditor
This patch decouples GTextDocument and GTextDocumentLine from the line
wrapping functionality of GTextEditor.

This should basically make it possible to have multiple GTextEditors
editing the same GTextDocument. Of course, that will require a bit more
work since there's no paint invalidation yet.
2019-10-27 18:00:07 +01:00
Andreas Kling
f1c6193d6d LibGUI: Move GTextDocument out of GTextEditor
The idea here is to decouple the document from the editor widget so you
could have multiple editors being views onto the same document.

This doesn't work yet, since the document and editor are coupled in
various ways still (including a per-line back-pointer to the editor.)
2019-10-27 16:44:16 +01:00
Andreas Kling
1bcbc3f827 HackStudio: Allow switching between the two editors with Ctrl+E :^)
This is very hackish and should be done differently, but the feature
feels pretty nice and does work for now.
2019-10-27 13:10:37 +01:00
Andreas Kling
1e5f4714c7 HackStudio: Tweak EditorWrapper layouts a bit to make things look nice 2019-10-27 13:06:30 +01:00
Andreas Kling
e39b1f11f9 HackStudio: Support multiple editors on screen
This patch adds Editor (subclass of GTextEditor) and EditorWrapper.
An EditorWrapper is a composite widget that adds a little statusbar
above an Editor widget. The statusbar is used for showing the filename
and the current cursor position. More things can definitely be added.

To get to the currently active editor, call current_editor().
You can also get to the current editor's wrapper by calling..
current_editor_wrapper(). Which editor is current is determined by
which was was last focused by the user.
2019-10-27 12:55:10 +01:00
Andreas Kling
de2b25e2c1 LibGUI: Move GTextRange and GTextPosition to their own header files 2019-10-27 11:23:53 +01:00
Andreas Kling
db5178fb8f GTextEditor: Double-clicking on a span should select the span
This makes double-clicking on a C++ token in HackStudio select the
whole token, which is pretty nice. It's not perfect in all cases,
but a lot nicer than just expanding until we hit whitespace. :^)
2019-10-27 11:18:19 +01:00
Andreas Kling
8fa466e496 GTextEditor: Backspace over soft tabs
This makes the backspace erase backwards until the next soft tab stop.
We currently always use 4 as the soft tab width, but I suppose we could
make it configurable at some point. :^)
2019-10-27 10:42:48 +01:00
Brandon Scott
98e556fee9 HexEditor: Created has_selection() method.
Created has_selection() method and fixed a few small issues.
2019-10-27 00:44:42 +02:00
Brandon Scott
c77fe5161c HexEditor: Added fill selection action.
Added the ability to fill the current selection with a given byte.
2019-10-27 00:44:42 +02:00
Brandon Scott
f947353a56 HexEditor: Added new file action.
Added a new file action, allowing you to create a new file of a specific
size.
2019-10-27 00:44:42 +02:00
Andreas Kling
90c81d5c16 HackStudio: Tweak style of C++ identifiers
On second thought, let's not have bold identifiers, as this ended up
making most of the code bold. :^)
2019-10-26 21:47:51 +02:00
Andreas Kling
dd74cb9c8f HackStudio: Focus the text editor after opening a file 2019-10-26 21:45:29 +02:00
Andreas Kling
cea6506998 HackStudio: Implement adding an existing file to project 2019-10-26 21:43:46 +02:00
Andreas Kling
4089690cf1 GFilePicker: Allow overriding the window title for get_open_filepath() 2019-10-26 21:42:34 +02:00
Andreas Kling
9129dbe0b9 HackStudio: Implement adding a new file to the project
You can now press Ctrl+N to create and add a new file to the project!
2019-10-26 21:28:31 +02:00
Andreas Kling
b513a787fb GTextEditor: set_text() should clear any existing spans 2019-10-26 20:21:12 +02:00
Andreas Kling
cdac60e876 LibHTML: Make <header> and <footer> be "display: block" by default
This makes http://www.motherfuckingwebsite.com/ readable :^)
2019-10-26 15:40:51 +02:00
Andreas Kling
bc2026d26d LibGUI: Make GTextEditor::Span have a range instead of two positions
A GTextRange is really just two GTextPositions (start and end) anyway.
This way we can say nice things like "if (range.contains(position))"
2019-10-26 15:33:19 +02:00
Andreas Kling
4fa8acf6ea GTextEditor: The Home key should jump to the first non-space character
Press Home twice to get to column 0. This feels way more natural.
2019-10-26 14:02:39 +02:00
Andreas Kling
532001f4c1 GTextEditor: Arrow keys should only modify selection when Shift is held 2019-10-26 14:01:53 +02:00
Andreas Kling
df7f3ca604 HackStudio: "Hide" the action tabs (find in files, console) by default
By "hide" I really mean collapse them down to 24px height. We grow them
to a normal size when they're needed. The user is also free to resize
them at will.

This keeps them out of the way when you just want to do editing. :^)
2019-10-26 12:30:49 +02:00
Andreas Kling
98a6149b4f LibGUI: Make GWindow drive relayout and do it recursively
Instead of only doing a relayout in the widget you're invalidating,
we now do a recursive top-down relayout so everything gets updated.

This fixes invalid results after updating a preferred size in some
situations with nested layouts.
2019-10-26 12:28:54 +02:00
Andreas Kling
d0799f3648 WindowServer: Center the mouse cursor on startup
The code was already trying to do this, but it was centering inside the
screen rect before we had a screen rect. :^)
2019-10-26 11:39:15 +02:00
Andreas Kling
db353a06e5 HackStudio: Enable line wrapping and automatic indentation by default 2019-10-26 11:33:39 +02:00
Andreas Kling
ed242d538a HackStudio: Assorted improvements to C++ highlighting
Add a list of hard-coded standard types (including AK types) and show
them in a different style.

Rehighligt the file whenever it changes. (This is very inefficient but
makes it much easier to experiment.)

Also keep tweaking the colors. :^)
2019-10-26 10:33:50 +02:00