summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibLine
AgeCommit message (Collapse)Author
2021-05-19Everywhere: Add missing includes for <AK/OwnPtr.h>Gunnar Beutner
Previously <AK/Function.h> also included <AK/OwnPtr.h>. That's about to change though. This patch fixes a few build problems that will occur when that change happens.
2021-05-16Userland: Don't explicitly call Vector<T>::is_null()Gunnar Beutner
This method always returns false so there's no reason for calling it.
2021-05-16LibLine: Make line management less broken when at the last lineAli Mohammad Pur
Previously, all sorts of weird stuff would happen when the editor was at the last line of the terminal (or when the printed line would be at the last line), this commit makes the editor scroll the terminal up before trying to write to a row that doesn't actually exist (yet). This fixes ^R search making a mess when initiated at the last line (especially with multiline prompts).
2021-05-12LibCore+Everywhere: Move OpenMode out of IODeviceAli Mohammad Pur
...and make it an enum class so people don't omit "OpenMode".
2021-05-11LibLine+Shell: Add dirty history flag and use itsin-ack
This patch adds a new flag called history_dirty to Line::Editor that is set when history is added to but written. Applications can leverage this flag to write history only when it changes. This patch adds an example usage of this functionality to Shell, which will now only save the history when it is dirty.
2021-05-07LibLine: Convert StringBuilder::appendf() => AK::FormatAndreas Kling
2021-05-01Everywhere: Turn #if *_DEBUG into dbgln_if/if constexprGunnar Beutner
2021-04-30LibLine: Fix writing to temporary file in ^X^E handlerAli Mohammad Pur
I have no idea how this _ever_ worked, and I also have no idea why past me didn't use FileStream to begin with. Fixes the issue where lots of junk data would be written to the temp file, causing the external editor to crash.
2021-04-29Everywhere: Use "the SerenityOS developers." in copyright headersLinus Groh
We had some inconsistencies before: - Sometimes "The", sometimes "the" - Sometimes trailing ".", sometimes no trailing "." I picked the most common one (lowecase "the", trailing ".") and applied it to all copyright headers. By using the exact same string everywhere we can ensure nothing gets missed during a global search (and replace), and that these inconsistencies are not spread any further (as copyright headers are commonly copied to new files).
2021-04-25Everywhere: Remove empty line after function body opening curly braceLinus Groh
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
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-21LibLine: Convert String::format() => String::formatted()Andreas Kling
2021-04-19LibLine: Avoid trying to restore() if the editor isn't initializedAli Mohammad Pur
Fixes #6472.
2021-04-19LibLine: Redraw the suggestions when terminal size changesAli Mohammad Pur
2021-04-17LibLine: Check the terminal size at the start of get_line()AnotherTest
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-17LibLine: Add support for ^X^EAnotherTest
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-03-16LibLine: Make the DSR response parser a bit more robustAnotherTest
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-13LibLine: Treat DEL as backspace by defaultAnotherTest
This can come in handy when telneting in.
2021-03-13LibLine: Don't try to print chars larger than 63 in caret formAnotherTest
Instead, mask them as `\xbb` so that e.g. DEL becomes `\x7f`. Fixes #5752.
2021-03-12Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)Andreas Kling
Good-bye LogStream. Long live AK::Format!
2021-03-11LibLine: Cleanup the suggestions before inserting a new code pointAnotherTest
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-07LibLine: Clear the buffer after invalidating prior written dataAnotherTest
Otherwise this would set m_chars_touched_in_the_middle to zero, which is exactly the wrong thing to do.
2021-02-24LibLine: Note that the search() call modifies the bufferAnotherTest
Fixes #5465.
2021-02-24LibLine: Update the drawn cursor value when updating lazilyAnotherTest
2021-02-24LibLine: Properly update the main editor when clearing the search editorAnotherTest
This broke after the lazy update change :P
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...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-21LibLine: Move the search editor exactly after the last lineAnotherTest
Previously, we'd always put it right after the prompt.
2021-02-21LibLine: Make clear_lines() work when only clearing the current lineAnotherTest
2021-02-21LibLine: Update the lazy refresh data and flags in some more placesAnotherTest
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-20LibLine: Avoid refreshing the entire line when inserting at the endAnotherTest
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-07LibLine: Place the search editor prompt at the right line after ^LAnotherTest
...as the search editor prompt has to always stay after the main prompt preview.
2021-02-07LibLine: Close the search editor when it's interruptedAnotherTest
Fixes #5233.
2021-01-31LibLine: Only print ascii characters in caret formAnotherTest
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-25Everywhere: Hook up remaining debug macros to Debug.h.asynts
2021-01-25Everywhere: Remove unnecessary debug comments.asynts
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-22Libraries: Add missing headersBen Wiederhake
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-16Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
2021-01-12LibLine: Use StringView::find() to find '::' in history entriesAnotherTest
Fixes an issue mentioned in #4926.
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling