summaryrefslogtreecommitdiff
path: root/Libraries/LibLine
AgeCommit message (Collapse)Author
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.
2020-05-26LibLine: Don't add empty lines to historyLinus Groh
2020-05-25LibLine: Change get_line to return a Result<String, Error>AnotherTest
This fixes a bunch of FIXME's in LibLine. Also handles the case where read() would read zero bytes in vt_dsr() and effectively block forever by erroring out. Fixes #2370
2020-05-23LibLine: Default to resetting styles when a cell has no styles setAnotherTest
2020-05-23LibLine: Make the comments follow the project styleAnotherTest
2020-05-23LibLine: Properly paginate suggestions in XtermSuggestionDisplayAnotherTest
This commit adds back suggestion pagination, and makes it 10x better. Also adds a "< page m of n >" indicator at the bottom if there are more suggestions than would fit in a page. It properly handles cycling forwards and backwards :^)
2020-05-23 LibLine: Add a constructor for CompletionSuggestions purely for comparisonAnotherTest
`CompletionSuggestion(text, ForSearch)` creates a suggestion whose only purpose is to be compared against. This constructor skips initialising the views.
2020-05-23LibLine: Refactor suggestion handling and display logic outAnotherTest
2020-05-23LibLine: Correctly handle multibyte codepoints in suggestionsAnotherTest
2020-05-23LibLine: Make suggest() utf8-awareAnotherTest
2020-05-21LibLine: Hide debug output behind SUGGESTIONS_DEBUG defineLinus Groh
2020-05-21LibLine: Correctly track the completion start and endAnotherTest
To achieve this, the API was tweaked a bit to allow for easier tracking of completions. This API change is non-disruptive to any application that does not use anchored styles.
2020-05-21LibLine: Support applying styles to suggestionsAnotherTest
This commit also adds the concept of "anchored" styles, which are applied to a specific part of the line, and are tracked to always stay applied to that specific part. Inserting text in the middle of an anchored style extends it, and removing the styled substring causes the style to be removed as well.
2020-05-20LibLine: Unify completion hooks and adapt its usersAnotherTest
LibLine should ultimately not care about what a "token" means in the context of its user, so force the user to split the buffer itself. This also allows the users to pick up contextual clues as well, since they have to lex the line themselves. This commit pacthes Shell and the JS repl to better handle completions, so certain wrong behaviours are now corrected as well: - JS repl can now complete "Object . getOw<tab>" - Shell can now complete "echo | ca<tab>" and paths inside strings
2020-05-19LibLine: Default to resolving Spans as byte offsetsAnotherTest
This allows all the unicode processing to be internal to the line editor.
2020-05-19LibLine: Handle <return>s in incomplete data correctlyAnotherTest
Previously, we would concatenate all the commands together: ``` > sleep 5 echo well echo hello echo friends > echo wellecho helloecho friends ``` Also renames some variables to be more descriptive.
2020-05-18LibLine: Handle unicode correctlyAnotherTest
This commit also fixes a problem with us throwing out data that was inserted while a command was running.
2020-05-14Build: Switch to CMake :^)Sergey Bugaev
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-13LibLine: Add a hook to run when an interrupt is handledAnotherTest
We do not want to clog up signal handlers by putting possibly complex logic inside them, so allow the editor to handle that.
2020-05-12LibLine: Fix suggestion spacing regressionAnotherTest
This patch fixes an issue where the line editor would put no spacing between suggestions (only when there are two suggestions). To reproduce, try on a build with no ports (starting with `pro`): ``` > pro<tab> profilepro ```
2020-05-11LibLine: Show suggestions in pages if they don't fit on the screenAnotherTest
We can now cycle pages of suggestions when there are more suggestions than we can fit on one screen. This does not inculude a visual indicator that more pages exist, however.
2020-05-10LibLine: Support RGB colorsAnotherTest
This also patches Userland/js.
2020-05-10LibLine: Expose actual_rendered_string_length & accept newlines in promptAnotherTest
2020-05-02LibLine: Handle ^L while in search modeAnotherTest
This commit fixes the following misbehaviour: ``` > <- search prompt moves here > > ^R^L <- actual prompt stays here ```
2020-04-30LibLine: Reset inline_search_cursor along with cursorAnotherTest
This fixes the issue where the editor would only scroll up one command and then 'search' for it
2020-04-30Shell+LibLine: Handle escaped characters correctlyAnotherTest
This patchset fixes incorrect handling of escaped tokens (`a\ b`) in Shell autocompletion and LibLine. The users of LibLine can now choose between two token splitting modes, either taking into account escapes, or ignoring them.
2020-04-29LibLine: Actually fix build :^)Andreas Kling
2020-04-28LibLine: Properly mark the result of read() as ignoredAnotherTest
Unbreaks the build.
2020-04-28LibLine: Drop stray input before doing vt_dsrAnotherTest
This patch fixes the issue where some data would be buffered while the editor is not editing, and vt_dsr would read them, resulting in the cursor to jump to (1,1)
2020-04-28LibLine: Handle initialize() internallyAnotherTest
This patch makes initialize() transparent to the users, but exposes it publicly, as the users might need a copy of the default termios (i.e. Shell)
2020-04-28LibLine: Ignore interrupts unless actively editingAnotherTest
It does not make much sense to receive an interrupt and process it *much later*. Also patches Userland/js to only create exceptions while some code is actually running.
2020-04-22LibLine: Do not ignore ^C and do not finish() after interruptAnotherTest