summaryrefslogtreecommitdiff
path: root/Libraries/LibLine
AgeCommit message (Collapse)Author
2020-08-21LibLine: Do not ignore Ctrl-C when buffer is emptyAnotherTest
I am told that this is how people test their shells. That's bizarre to me, but sure :^)
2020-08-21LibLine: Handle interrupts/window size changes internallyAnotherTest
2020-08-21LibLine: Handle Ctrl-C and Ctrl-D in a way similar to other line editorsAnotherTest
Makes C-c print "^C" and continue prompting on a new line. Also fixes a problem where an interrupted get_line() would need more read()'s than required to update the display.
2020-08-20LibLine: Initialize the search editor when entering searchAnotherTest
Prior to this, no keybinding were installed on the search editor, and so editing wasn't really possible. Also fixes <C-r> making infinite search editors.
2020-08-18LibLine: Make actual_rendered_string_metrics() staticAnotherTest
This function didn't depend on the editor itself.
2020-08-18LibLine: Setup the keybindings after initialisationAnotherTest
This makes the keybindings that depend on `m_termios` (^W, ^U, etc) work.
2020-08-18LibLine: Allow the user to override (or add) keybinds in the config fileAnotherTest
2020-08-18LibLine: Make (almost) all key actions configurableAnotherTest
This moves all internal functions to a new file, and defines the old keybinds with register_key_input_callback().
2020-08-18LibLine: Read configuration from a config fileAnotherTest
2020-08-17LibLine: Add a getter for num_lines/num_colsAnotherTest
2020-08-17LibLine: Uninitialized members in Editor, found by CoverityBrian Gianforcaro
2020-08-09LibLine: Only write to the standard errorAnotherTest
This fixes `> asdf` and allows for all sorts of stdout redirections.
2020-08-07LibLine: Add Ctrl-k shortcutNico Weber
Only does the 'delete to end of line' bit for now. No yank ring support yet.
2020-08-07LibLine: Add Alt-t shortcut for transposing wordsNico Weber
2020-08-06LibLine: Add binding for Alt-backspaceNico Weber
It backward-deletes a word like Ctrl-W, but it has a slightly different definition of what a word is. For example, with the caret behind `gcc -fsanitize=address`, Ctrl-W would delete '-fsanitize=address' but Alt-backspace would only delete 'address'.
2020-08-06LibLine: Fix "word" handling for alt-d/u/l/c/f/b and ctrl-left/rightNico Weber
All these shortcuts treat consecutive alnums as a word, not consecutive non-spaces. For example, `alias KILL='kill -9'` can now be written by typing it out lowercase, then hitting ctrl-a alt-f alt-u. Ctrl-W still treats a word as a sequence of non-spaces. Alt-backspace in a future patch will add the ability to backward-delete a word that's a sequence of alnums.
2020-08-06LibLine+Shell: Remove unused split_mechanismNico Weber
It was only read in should_break_token(), which had no callers. should_break_token() also got `foo\\ bar` and `"foo bar"` wrong.
2020-08-06LibLine: Add binding for Alt-.Nico Weber
2020-08-06LibLine: Add bindings for Alt-u, Alt-l, Alt-cNico Weber
2020-08-06LibLine: Add comments for which keys trigger VWERASE and VKILLNico Weber
2020-08-06LibLine: Add Alt-d binding to forward-delete a wordNico Weber
2020-08-06Shell: Start adding some alt shortcutsNico Weber
This adds Alt-f to go forward by a word, and Alt-b to go backward by a word (like ctrl-arrow-left / ctrl-arrow-right already do). Behind the scenes, alt-key is implemented by sending <esc> followed by that key, and typing <esc> f/b for moving by a word hence works too (in all other shells too, not just in Serenity's). While here, rename some InputState enum values to make the slightly expanded use of <esc> clearer, and expand a few comments.
2020-08-05Unicode: Try s/codepoint/code_point/g againNico Weber
This time, without trailing 's'. Ran: git grep -l 'codepoint' | xargs sed -ie 's/codepoint/code_point/g
2020-08-05Revert "Unicode: s/codepoint/code_point/g"Nico Weber
This reverts commit ea9ac3155d1774f13ac4e9a96605c0e85a8f299e. It replaced "codepoint" with "code_points", not "code_point".
2020-08-05LibLine: Check if operating on a TTY before using TTY featuresAnotherTest
This makes the line editor behave well when input is passed in from pipes as well.
2020-08-04LibLine: Removed unused private field m_prompt_metricsNico Weber
2020-08-03Unicode: s/codepoint/code_point/gAndreas Kling
Unicode calls them "code points" so let's follow their style.
2020-08-02AK: Fix overflow and mixed-signedness issues in binary_search() (#2961)Muhammad Zahalqa
2020-07-26Refactor: Change the AK::binary_search signature to use AK::Span.asynts
2020-07-13LibLine: Add Ctrl-N/P as history next/previous shortcutsNico Weber
2020-07-13LibLine: Move search-related updates into do_cursor_left/rightNico Weber
This way, arrow-left and arrow-right behave consistently with ctrl-b/ctrl-f.
2020-07-07LibLine: Add ctrl-t shortcut for transposing charactersNico Weber
2020-07-07LibEdit: Make Ctrl-d on an empty line mean EOD againNico Weber
2020-07-06LibLine: Support Ctrl-b/f and Ctrl-dNico Weber
And make the existing cltr-h handler easier to see.
2020-07-06LibLine: Extract lambdas for cursor-left, cursor-right, deleteNico Weber
Also move the existing backspace lambda out of the loop. The do_delete() extraction fixes a minor bug where InputState::ExpectTerminator wasn't entered if delete was pressed at the very end of a line. Now that this is fixed, there's no more "LibLine: Unhandled final: 7e (~)" when hitting delete at the end of the line.
2020-07-06LibLine: Put ctrl-key handlers in alphabetical orderNico Weber
2020-07-06LibLine: Replace some magic numbers with a magic functionNico Weber
2020-07-06LibLine: Avoid refreshing the display when resizingAnotherTest
This allows was_resized() to be called while the editor is not active (i.e. get_line() is not in frame).
2020-06-30LibLine: Correctly display suggestions on multiline promptsAnotherTest
2020-06-27LibLine: Support multiline editingAnotherTest
This commit also updates Shell, which uses actual_rendered_length.
2020-06-12AK: Make string-to-number conversion helpers return OptionalAndreas Kling
Get rid of the weird old signature: - int StringType::to_int(bool& ok) const And replace it with sensible new signature: - Optional<int> StringType::to_int() const
2020-06-07LibLine: Correctly handle line content overflow when on last lineAnotherTest
Fixes #2525
2020-06-07LibLine: Use more descriptive names for row/columnAnotherTest
The names x and y caused confusion because of their typical use as horiz/vert.
2020-06-01LibLine: Handle interrupts againAnotherTest
This commit makes LibLine handle interrupts (as reported via interrupted() and resized()) again. There is a little catch with the shell: ``` $ ls | pipe> <C-c> (prompt stays here until a key is pressed) ```
2020-05-29LibLine: Remove unused header in Span.hEmanuele Torre
2020-05-29Meta: Add a script check the presence of "#pragma once" in header filesEmanuele Torre
.. and make travis run it. I renamed check-license-headers.sh to check-style.sh and expanded it so that it now also checks for the presence of "#pragma once" in .h files. It also checks the presence of a (single) blank line above and below the "#pragma once" line. I also added "#pragma once" to all the files that need it: even the ones we are not check. I also added/removed blank lines in order to make the script not fail. I also ran clang-format on the files I modified.
2020-05-27LibLine: Send over some properties when being inspectedAnotherTest
2020-05-27LibLine: Use Core::EventLoop for outer read loopAnotherTest
This commit changes LibLine's internal structure to work in an event loop, and as a result, also switches it to being a Core::Object.
2020-05-26LibLine: Use LibC's getline() when the terminal claims no support for escape ↵AnotherTest
sequences We just look at $TERM and refuse to emit any escape sequences if it doesn't start with "xterm". This could be made much better, at detecting, and at not caling getline().
2020-05-26AK: Rename FileSystemPath -> LexicalPathSergey Bugaev
And move canonicalized_path() to a static method on LexicalPath. This is to make it clear that FileSystemPath/canonicalized_path() only perform *lexical* canonicalization.