Age | Commit message (Collapse) | Author |
|
Previously, calling `.right()` on a `Gfx::Rect` would return the last
column's coordinate still inside the rectangle, or `left + width - 1`.
This is called 'endpoint inclusive' and does not make a lot of sense for
`Gfx::Rect<float>` where a rectangle of width 5 at position (0, 0) would
return 4 as its right side. This same problem exists for `.bottom()`.
This changes `Gfx::Rect` to be endpoint exclusive, which gives us the
nice property that `width = right - left` and `height = bottom - top`.
It enables us to treat `Gfx::Rect<int>` and `Gfx::Rect<float>` exactly
the same.
All users of `Gfx::Rect` have been updated accordingly.
|
|
Strings include ASCII, UTF-8, and UTF-16
Co-authored-by: Andreas Krohn <hamburger1984@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Specifically, the ones HexEditor::did_complete_action possibly raised in
case creating an undo stack entry or pushing it onto the undo stack
fails. In this case, an error popup is displayed and the modifications
are undone.
This removes 2 FIXMEs inside the code :^)
|
|
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.
One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
|
|
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
|
|
|
|
|
|
|
|
|
|
The selected region in HexEditor is indicated by rendering a different
background color for the selected bytes.
Previously this background was rendered so that the background
rectangles were not contigous between different rows. This caused a high
contrast pattern that interfered with the readability of the hexadecimal
digits.
Now the background is rendered as a single contiguous block.
|
|
The 'select all' feature now also selects the last byte of the document.
The find function now also selects the last byte of a match.
|
|
This also changes those variables to be references to the casted
document type, instead of pointers.
|
|
Returning a `bool` is meaningless, so let's make it more expresive :^)
|
|
`HexEditor::set_readonly` was never called, even though
`HexEditor::is_readonly` was occasionally queried -- so it's entirely
been removed.
|
|
For each string found we would output it, which was way too much noise
:^)
|
|
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).
No functional changes.
|
|
This should improve an overall visibility of "meaningful" data. :^)
|
|
|
|
|
|
|
|
|
|
This patch makes the HexEditor behaviour similar to the one of the
text editor, this can be seen by pressing shift and the arrow keys
|
|
Before this patch the fill selection command would set the selection
and one byte after it
|
|
|
|
In such case, move the cursor up or down the amount of bytes per row,
multiplied by the visible content rectangle height, if possible.
|
|
Instead of having the same update block for each event we can use lambda
functions to help updating the cursor when handling key down events.
|
|
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules
"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
|
|
Now the copy action takes exactly the selected chars and not one more.
|
|
Apologies for the enormous commit, but I don't see a way to split this
up nicely. In the vast majority of cases it's a simple change. A few
extra places can use TRY instead of manual error checking though. :^)
|
|
|
|
There's enough line space to use readable variable names.
|
|
When a file is opened and scrolled to some position and the user opens
another file, the current scroll position stays the same. That's
disorienting. Therefore, when opening another file, scroll back to the
top.
|
|
To support editing of large files it is an advantage to not load the
entire file into memory but only load whatever is needed for display at
the moment. To make it work, file access is abstracted into a socalled
HexDocument, of which there two: a memory based and a file based one.
The former can be used for newly created documents, the latter for file
based editing.
Hex documents now do track changes instead of the HexEditor. HexEditor
only sets new values. This frees HexEditor of some responsibility.
|
|
|
|
There are a lot of numbers just floating around in the code.
Give them proper names.
|
|
File positions as well as selection positions should be size_t,
as they are never negative and can become quite big.
|
|
The magic constant does not work together well with themes.
As there does not seem to be a suitable palette color for this,
simply invert the color.
|
|
For better visibility of wether the editing focus is on the hex or the
ascii view, render a blinking caret instead of a solid cell background.
For that to work, it's also necessary to change the way selection works.
The selection shouldn't extend to the current position but up to the
byte before it.
|
|
This resolves #10641.
|
|
|
|
Most of the code here is based off the implementation of how
TextEditor uses FileSystemAccessClient.
|
|
find_and_highlight() selected +1 too many bytes.
'Select All' selected +1 too many bytes past the end of
the buffer.
Status bar 'Selected Bytes' count was off by -1 when more
than zero bytes were selected.
|
|
|