Commit graph

29 commits

Author SHA1 Message Date
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling
90ee84621f LibLine: Convert String::format() => String::formatted() 2021-04-21 23:49:02 +02:00
Ali Mohammad Pur
74f0fdab98 LibLine: Avoid trying to restore() if the editor isn't initialized
Fixes #6472.
2021-04-19 16:28:33 +02:00
Ali Mohammad Pur
e1e84fe0fe LibLine: Redraw the suggestions when terminal size changes 2021-04-19 16:28:33 +02:00
AnotherTest
fb80d5adda LibLine: Check the terminal size at the start of get_line()
There are cases where the line editor could miss the WINCH signal
(e.g. in the shell, while another program is in the foreground),
This patch makes it so that LibLine notices the change in terminal size
in such cases.
2021-04-17 22:10:35 +02:00
AnotherTest
b58dbc29fc LibLine: Add support for ^X^E
This keybind opens the current buffer in an editor (determined by
EDITOR from the env, or the default_text_editor key in the config file,
and set to /bin/TextEditor by default), and later reads the file back
into the buffer.
Pretty handy :^)
2021-04-17 22:10:35 +02:00
AnotherTest
80d21f120f LibLine: Make the DSR response parser a bit more robust
At the cost of using more read() syscalls, process the DSR response
character-by-character.
This avoids blocking forever waiting for an 'R' that will never come :P
2021-03-16 21:51:49 +01:00
AnotherTest
5a0ebdb109 LibLine: Treat DEL as backspace by default
This can come in handy when telneting in.
2021-03-13 19:34:25 +01:00
AnotherTest
745b0800be LibLine: Don't try to print chars larger than 63 in caret form
Instead, mask them as `\xbb` so that e.g. DEL becomes `\x7f`.
Fixes #5752.
2021-03-13 19:34:25 +01:00
Andreas Kling
ef1e5db1d0 Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)
Good-bye LogStream. Long live AK::Format!
2021-03-12 17:29:37 +01:00
AnotherTest
eb1ca965c7 LibLine: Cleanup the suggestions before inserting a new code point
Otherwise `reposition_cursor()` will move the cursor one character too
far to the right, and since we don't redraw the entire buffer when
the character is inserted at the end, the mistake won't be immediately
fixed by a complete redraw.
Fixes #5722
2021-03-11 14:47:56 +01:00
AnotherTest
cad7865ad1 LibLine: Clear the buffer after invalidating prior written data
Otherwise this would set m_chars_touched_in_the_middle to zero, which is
exactly the wrong thing to do.
2021-03-07 10:59:51 +01:00
AnotherTest
71de5433f8 LibLine: Note that the search() call modifies the buffer
Fixes #5465.
2021-02-24 12:19:20 +01:00
AnotherTest
dd87b14f52 LibLine: Update the drawn cursor value when updating lazily 2021-02-24 12:19:20 +01:00
AnotherTest
21cbcdd7da LibLine: Properly update the main editor when clearing the search editor
This broke after the lazy update change :P
2021-02-24 12:19:20 +01:00
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
2021-02-23 20:56:54 +01:00
AnotherTest
d8a3285d78 LibLine: Move the search editor exactly after the last line
Previously, we'd always put it right after the prompt.
2021-02-21 09:01:00 +01:00
AnotherTest
9790ee4649 LibLine: Make clear_lines() work when only clearing the current line 2021-02-21 09:01:00 +01:00
AnotherTest
6472e5239c LibLine: Update the lazy refresh data and flags in some more places
These were forgotten in the last LibLine commit, any changes to m_buffer
not going through insert() and remove_at_index() should also be updating
these.

Fixes #5440.
2021-02-21 09:01:00 +01:00
AnotherTest
074e2ffdfd LibLine: Avoid refreshing the entire line when inserting at the end
This patchset allows the editor to avoid redrawing the entire line when
the changes cause no unrecoverable style updates, and are at the end of
the line (this applies to most normal typing situations).
Cases that this does not resolve:
- When the cursor is not at the end of the buffer
- When a display refresh changes the styles on the already-drawn parts
  of the line
- When the prompt has not yet been drawn, or has somehow changed

Fixes #5296.
2021-02-20 22:28:23 +01:00
AnotherTest
6985b4008a LibLine: Place the search editor prompt at the right line after ^L
...as the search editor prompt has to always stay after the main prompt preview.
2021-02-07 13:12:56 +01:00
AnotherTest
3a231c00aa LibLine: Close the search editor when it's interrupted
Fixes #5233.
2021-02-07 13:12:56 +01:00
AnotherTest
3b9ead985c LibLine: Only print ascii characters in caret form
ctype's `iscntrl` truncates its input, making some codepoints appear as
control characters. Avoid this by checking whether the character is in
ascii to begin with.
2021-01-31 19:06:02 +01:00
asynts
eea72b9b5c Everywhere: Hook up remaining debug macros to Debug.h. 2021-01-25 09:47:36 +01:00
asynts
acdcf59a33 Everywhere: Remove unnecessary debug comments.
It would be tempting to uncomment these statements, but that won't work
with the new changes.

This was done with the following commands:

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/#define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/#define/ { toggle = 1 }' {} \;

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/ #define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/ #define/ { toggle = 1 }' {} \;
2021-01-25 09:47:36 +01:00
Ben Wiederhake
67cda61b7f Libraries: Add missing headers
A C++ source file containing just
    #include <LibFoo/Bar.h>
should always compile cleanly.

This patch adds missing header inclusions that could have caused weird error
messages if they were used in a different context. Also, this confused QtCreator.
2021-01-22 21:49:54 +01:00
asynts
01879d27c2 Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
2021-01-16 11:54:35 +01:00
AnotherTest
72be904259 LibLine: Use StringView::find() to find '::' in history entries
Fixes an issue mentioned in #4926.
2021-01-12 23:36:20 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00