crossterm 0.23 seems to have introduce a regression on windows for
decoding keybindings with `ctrl` that uppercases the char.
Tracking issue crossterm-rs/crossterm#636
Might be fixed by crossterm-rs/crossterm#629
Changes the `Highlighter` trait to include the position of the cursor in
the buffer. This allows it to make cursor aware highlighting such as
highlighting matching braces or code blocks
Prerequisite to address nushell/nushell#4325
Instead of affecting the editor this lets `Reedline::read_line` return
with `Ok(Signal::Success)` containing a predefined command to be executed or
consumed by the app using `reedline` as a line editor.
The state of the editor is preserved. After the command execution in a
REPL the host would call `Reedline::read_line` again and the line editor
would be redrawn on the next free line.
Command will not be added to the history in this config.
Open for debate if this should not expect printed output from the
command and try to redraw on top or reset some state.
Addresses #312
Keybindings are currently configured to require the completion menu. To
use the completions you have to manually add it.
Undocumented: Changing the keybindings to use the old bash style
completions with `CircularCompletionHandler`
Track #307
Add safe `sync` method to `History`
This method both reads from the file and writes local additions. Is safe
when multiple `History` instances try to truncate the history file on
disk.
To avoid race conditions on the file uses the `fd_lock` crate for file
advisory locks. (Inspiration for that thanks to rustyline: https://github.com/kkawakam/rustyline/blob/master/src/history.rs)
Fixes#221
- Cover history file ops with tests
- Add test for conflicting writes that should truncate
- Add safe `sync` method to `History`
- Test `FileBackedHistory` for threadsafety
To allow the automatic execution of multiple new line separated lines
only take events up until enter and execute to check if complete valide
expression. Remaining events present in crossterms event queue will be executed on next invocation.
Removes the need for the explicit Paste event, which in it's current
implementation did not provide a performance benefit over the existing
machinery (From the current state, it seems that the performance
improvement of that patch relies on the change in inner loop poll
timeout)
Introduces a minimal performance regression for pasting large text
containing many newlines which is a single valid entry as after the
validation step a repaint is triggered
Fixes#282
All `repaint`/`buffer_paint` calls are removed from the event handling,
instead the `EventStatus` determines if a repaint is necessary:
- `Handled` -> repaint
- `Inapplicable` -> no action was taken, thus no need to repaint
Additionally some conditions to check and repeatedly used patterns
abstracted as methods.
* Make cntrl-arrow keys available with vi insert
Move the key bindings based on cntrl arrow keys to the shared defaults
and place the emacs only alt-special keys to emacs
* Move emacs keybindings to eponymous file
* Correct allocation behavior of `coerce_crlf`
Empty string optimization of Cow<str> has to be avoided when trying to
use pre-sized buffers
* Consolidate names to `screen_width/height`
* Simplify the `PromptCoordinate` down to the row
Column of the prompt origin is never different from 0, can thus be
elided.
* Encapsulate the large buffer state readonly
* Consolidate line requirement calculion
Currently several places exists that try to estimate the number of lines
required for a given content
Extract for obvious places in the painter
Rename 'estimated_wrapped_line_count` due to misleading name to
`estimate_single_line_wraps`
* Unify painter initialization step
Prevents misuse of the painter that would cause overflows in position
calculations due to size and prompt positions being out of lockstep
* Fix painter debug output
The prompt initialization was still hardcoded for the two line prompt.
Now all adaptation to account for the number of prompt lines is done
during repaint