summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibLine
AgeCommit message (Collapse)Author
2022-02-13LibJS+LibLine: Run clang-formatAndreas Kling
2022-02-13LibLine: Fix loading of terminal dimensions when running under lldbAnonymous
2022-01-07LibLine: Replace call to vfork() with fork()Andrew Kaster
We don't actually have a non-trivial vfork implementation, so just call fork(). As a bonus, vfork() is deprecated in XCode 13.1 when targeting macOS Big Sur, so this removes a blocker from updating our macOS CI version.
2022-01-01LibLine: Avoid unnecessary copies in EditorBen Wiederhake
2021-12-16LibLine: Switch all files to use east-constAli Mohammad Pur
2021-12-16LibLine: Update the prompt origin after resize + suggestion redisplayAli Mohammad Pur
2021-12-16LibLine: Take the prompt into account when adjusting for a scrolled viewAli Mohammad Pur
Otherwise we'd end up putting the prompt *after* the previous prompt instead of *over* it when showing suggestions that span more lines than are available without scrolling.
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-11-10AK: Make ByteBuffer::try_* functions return ErrorOr<void>Andreas Kling
Same as Vector, ByteBuffer now also signals allocation failure by returning an ENOMEM Error instead of a bool, allowing us to use the TRY() and MUST() patterns.
2021-10-08Libraries: Fix -Wunreachable-code warnings from clangNico Weber
2021-09-07Everywhere: Behaviour => BehaviorAndreas Kling
2021-09-06Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safeAli Mohammad Pur
2021-09-06Everywhere: Use OOM-safe ByteBuffer APIs where possibleAli Mohammad Pur
If we can easily communicate failure, let's avoid asserting and report failure instead.
2021-09-02Userland: Migrate to argument-less deferred_invokesin-ack
Only one place used this argument and it was to hold on to a strong ref for the object. Since we already do that now, there's no need to keep this argument around since this can be easily captured. This commit contains no changes.
2021-08-22Everywhere: Rename get in ConfigFile::get_for_{lib,app,system} to opennetworkException
This patch brings the ConfigFile helpers for opening lib, app and system configs more inline with the regular ConfigFile::open functions.
2021-07-21LibLine: Correct spelling mistake in variable nameJamie Mansfield
This corrects the spelling of 'matching' from 'macthing'.
2021-07-20LibLine: Avoid excessive write() syscalls when refreshing the displayAli Mohammad Pur
Previously, we were generating the display update one character at a time, and writing them one at a time to stderr, which is not buffered, doing so caused one syscall per character printed which is s l o w (TM) This commit makes LibLine write the update contents into a buffer, and flush it after all the update is generated :^)
2021-07-20LibLine: Reset the suggestion page offset when finding the max lengthAli Mohammad Pur
Otherwise, something like shift+tab->tab->tab will mess up the page contents (assuming that the max lengths in the pages are different).
2021-07-02AK: Implement String::find_any_of() and StringView::find_any_of()Max Wipfli
This implements StringUtils::find_any_of() and uses it in String::find_any_of() and StringView::find_any_of(). All uses of find_{first,last}_of have been replaced with find_any_of(), find() or find_last(). find_{first,last}_of have subsequently been removed.
2021-06-23LibLine: Recalculate the origin on resizeAli Mohammad Pur
2021-06-07LibLine: Actually remove the two levels of deferred_invokeAli Mohammad Pur
4d5cdcc89394259019828f123039104d6f4039e2 partially reverted the changes from d8c5eeceabbeaedc29823f12cc8a9cfac6f84686, but it reverted too much and reintroduced the bug. This commit finally fixes the actual bug. The author hasn't been in his best committing state today.
2021-06-07LibLine: Partially revert d8c5eec and remove unrelated codeAli Mohammad Pur
This is a partial revert of d8c5eeceabbeaedc29823f12cc8a9cfac6f84686 as it contained unrelated code that was committed accidentally, which broke history on LibLine.
2021-06-06LibLine: Keep the CSI bytes alive across read eventsAli Mohammad Pur
Otherwise we would lose the CSI parameters and intermediates if the whole sequence was split between two reads. Fixes #7835.
2021-06-06LibLine: Stop registering the Notifier as a child ObjectAli Mohammad Pur
We're already keeping it alive via `m_notifier`. This makes the event loop quitting logic simpler by making less deferred calls and removes a race condition where the notifier would be deleted before the second deferred_invoke() would be invoked, leading to a nullptr dereference. Fixes #7822.
2021-06-04LibLine: Actually cancel the search editor on Ctl-Cbrapru
When the search editor calls on really_quit_event_loop to cancel the search, the command loaded in m_buffer would actually execute because really_quit_event_loop sends a new line character and then afterwards clears the buffer. By using end_search prior to exiting the event loop, this patch will appropriately clear the buffer, not execute any commands, and preserve the original loaded buffer after returning from a canceled search.
2021-06-03Everywhere: Replace ctype.h to avoid narrowing conversionsMax Wipfli
This replaces ctype.h with CharacterType.h everywhere I could find issues with narrowing conversions. While using it will probably make sense almost everywhere in the future, the most critical places should have been addressed.
2021-05-29Everywhere: Sort out superfluous QuickSort.h importsBen Wiederhake
They were sorta unneeded. :^)
2021-05-24LibLine+Shell: Allow some programs to modify the current termiosAli Mohammad Pur
This setting can be controlled by setting the PROGRAMS_ALLOWED_TO_MODIFY_DEFAULT_TERMIOS _local_ shell variable to a list containing such programs.
2021-05-24LibLine: Add bracketed paste mode supportAli Mohammad Pur
This mode makes the editor insert all the "pasted" text into the buffer without interpreting it in any way.
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