The only downside is we are limited to 4 recent projects now. LibGUI
currently relies on the number of recent files being constexpr, so that
will take some more work to make it variable.
A couple of tweaks here to make it work better:
- Call `set_cursor_and_focus_line()` to make the Editor scroll to the
symbol's location.
- Remove focus from the Locator's text box so your cursor jumps to the
Editor instead of staying in the Locator.
Relative paths cause issues in a couple of ways:
- `open_project()` sets the working directory to that path, and then
opens a project at that same path. This means opening `./foo` goes to
`./foo`, and then tries to open `./foo/foo`.
- Even with that rearranged, we would then have issues with trying to
open files, because again we would try to open `./foo/foo/file`
instead of `./foo/file`.
- The relative path would get saved in "Recent Projects" which is wrong.
Absolutizing the path before using it means we avoid these issues, and
without having to rearchitect everything. :^)
When re-opening an existing file, we would reuse the document and
register a new Editor with it, but never unregister that Editor.
Previously, this would cause a crash if you opened a binary file, closed
its tab, then opened that binary file again. HackStudio would crash
while calling `HackStudio::EditorWrapper::update_title()` on an invalid
EditorWrapper. But now it doesn't!
Something still gets leaked each time, but we now don't crash at least.
This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).
This commit is auto-generated:
$ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
Meta Ports Ladybird Tests Kernel)
$ perl -pie 's/\bDeprecatedString\b/ByteString/g;
s/deprecated_string/byte_string/g' $xs
$ clang-format --style=file -i \
$(git diff --name-only | grep \.cpp\|\.h)
$ gn format $(git ls-files '*.gn' '*.gni')
When running build while having unsaved changes in HackStudio, it asks
whether you want to save the unsaved files with a separate dialog. When
you click "Yes" to saving the files, but deny the save-file dialog,
HackStudio would crash, since we were expecting there to be a file
to save to. Now, we check whether a file was picked, and if not, we
abort the build.
Move TabPosition into its own file, and using it into the global
namespace the same way we do for Gfx::Orientation. This unbreaks the gn
build, and out of tree builds.
This commit removes DeprecatedString's "null" state, and replaces all
its users with one of the following:
- A normal, empty DeprecatedString
- Optional<DeprecatedString>
Note that null states of DeprecatedFlyString/StringView/etc are *not*
affected by this commit. However, DeprecatedString::empty() is now
considered equal to a null StringView.
This feature is similar to Clion's "Open files with Single Click" which
allows user to open file without double clicking it
HackStudio: Update action name to remove "toggle"
Action name does need to include "Toggle" word since its already implie
d with checkable action
This also straightens out the logic to determine the project_path.
Instead of calling realpath on potentially-null strings and sometimes
not even reading the result, we now only make these calls when required,
and properly handle any error.
Corrects a slew of titles, buttons, labels, menu items and status bars
for capitalization, ellipses and punctuation.
Rewords a few actions and dialogs to use uniform language and
punctuation.
That pattern seems to show up a lot in code written by people that
aren't intimately familiar with the lifetime model of Error and Strings.
This commit makes the compiler detect it and present a more helpful
diagnostic than "garbage string at runtime".
Upon opening already opened file, the cursor was previously not
set to the correct line and column. With this patch, it should
be correctly set.
Fixes a bug where ctrl+clicking a function declaration would not
jump to the line if the file containing the function is already
open.
TextEditor, HackStudio and SQLStudio now print the current line and
column number, as well as the number of currently selected words, with
thousands separators.
TextEditor also uses thousands seperators for the current word and
character count.
The one behavior difference here is that the statusbar used to display
"Unknown" for unknown file types, and "Markdown" for md, but we now
display "Plain Text" for all file types without syntax highlighters.
This class had slightly confusing semantics and the added weirdness
doesn't seem worth it just so we can say "." instead of "->" when
iterating over a vector of NNRPs.
This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
We were only setting the wrapping mode when triggering the action. So:
- Any editors open without triggering a wrapping-mode action would have
the default (WrapAtWords) instead of the selected item (NoWrap).
- Any editors opened after triggering an action would have the default
too.
This fixes both situations, by:
- Storing the current wrapping mode in `m_wrapping_mode`. Later this
could be loaded from the config.
- Changing that value any time a wrapping-mode action is triggered.
- Setting the wrapping mode on newly-created editors.