- current line detection was off on the first position of a following
line
- find_current_line_end was not correctly aware of CRLF platforms
- Increase of coverage for some old functions
- Moves to start and beginning of the line
- Make start and end of buffer available for move via `Ctrl-Home` and
`Ctrl-End`
- Support vi style cutting of whole lines in the cut buffer.
- add vi style `p` after paste in addition to before cursor paste with
`P` or in emacs mode
- Enables vi style `dd` and paste
- Make sure the line to end cut and clear operations work only on the
line
* Disable hints during history traversal
Additional autosuggestion (history) hints are confusing while
navigating through the history.
Example history:
```
hello test
hello
something else
hello world
whatever
```
- Type `h`
- Press up arrow
- Prefix based history search will return `hello world`
- Press up arrow again
- Previously `hello <hint>world</hint>` now just `hello`
* Reduce code duplication before painting
* Move history newline escape to the file IO
Avoids potential interference with history search, makes
`History::iter_chronologic` nice again, simplifies it regarding hints
and should address the `history` command in a better way.
+ Extract escape
+ Remove unwrap
* Remove unnecessary optional history allocation
No need to clone if entry is duplicate or empty
* Offset setting changes
* Rename `PromptWidget` to `PromptCoordinates`
* Explicit setters
* Set offset implicitly on `full_repaint`
* Rename origin and offset
As suggested by JT
origin -> prompt_start
offset -> input_start
* Move tracking of offsets and size into painter
Relatively basic refactor of all tracking of prompt/input offsets as
well as the terminal size into the painter.
Some cooperative behavior in the engine is still required
Wrapping handler is currently still a crutch in the engine as it is not
`InsertChar` specific and should be handled for every buffer change
instead
* Simplify restore from history stearch
Prompt is simply updated via full repaint
* Fix ansi coloring for history prompt
also ignore reset color in non ansi colored mode
* Make pedantic clippy happier
* Ensure prompt creation is tight and not wrapping
Fix additional line that is created upon prompt creation if the previous
output was printing a new line. Also ensures that line clearing and
regular prompt creation at the bottom of the screen doesn't cause
scrolling issues (Currently a hardcoded solution for the two line
prompt)
Also reduces the API surface for tools only necessary to deal within raw
mode.
* Fix doctests for internals removal
`print_crlf()` was removed from the public API as it should only be used
in raw mode for internal stuff.
As soon as we leave `Reedline.read_line()` raw mode should be disabled
and the regular print macros should work as expected
Panicking inside reedline (or bubbling up an Err inside reedline's
critical sections that gets unwrapped/expected by the hosting
application) leaves the terminal in a bad state. Workaround that should
also work without cooperation by the consumer would be to include a call
to `disable_raw_mode` in the `Drop` trait. With standard stack-unwinding
panics will call the drop.
Calling `crossterm::terminal::disable_raw_mode` twice seems to be fine
if the program started in non-raw mode (under linux)
* Improve undo of EditCommands
Address #190
Formalize the undo role of different edit commands via exhaustive
matching
Will track every move, but won't cause inconsistent cursor jumps while
undoing
* Multiline continuation prompt introduced
* Hardcoded multiline continuation prompt styling
A way to convert `crossterm::style::Color` in `nu_ansi_term::Color` must
be found/implemented. This enables creating a Style from it.
Otherwise, it is necessary that the Style of the prompt is accessible
from everywhere.
* Forward Prompt's multline prompt to rendering func
* Finish #185
Co-authored-by: Antonio Natilla <antonio.natilla@studenti.unimi.it>
Co-authored-by: sholderbach <ho.steve@web.de>
Avoids jumping cursor to the prompt on full repaints of the standard
buffer. Does not completely remove a perceptable flicker at the fixed
position if animation is active.
Partially addresses #174 as other cases still need to be checked for
cursor updates
* Multiline continuation prompt introduced
* Hardcoded multiline continuation prompt styling
A way to convert `crossterm::style::Color` in `nu_ansi_term::Color` must
be found/implemented. This enables creating a Style from it.
Otherwise, it is necessary that the Style of the prompt is accessible
from everywhere.
Co-authored-by: Antonio Natilla <antonio.natilla@studenti.unimi.it>
* Drain crossterm events, prioritize last resize
This attempts to address #166, some slowness is still observed
Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
* Fix timing of repaint with drained events
* Initial code to coalesce edit commands
Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
Support for Shift-AltGr is required for several European keyboards (e.g. italian) #169#136#139#171
* Curly braces fix
* Curly braces fix for vim events
Co-authored-by: Antonio Natilla <antonio.natilla@studenti.unimi.it>
* Introduced 'repaint' flag on struct ReedLine, and associated builder function
* Added builder to configure and disable idle animations
* Ran `cargo fmt` and `cargo clippy`
* [BugFix] undo function
This commit solves the problem that when the undo function is performed,
for some reason the buffer remained with 1 character.
The FIX consists in correcting the logic of the current implementation
by bringing it to the initial design state; Where the vector of the
buffer had been initialized with an empty entry so that when performing
many times the undo brought you back to an initial condition with
the blank buffer rather than show you the first character.
* [Add] doc-test for set_previous_lines
This test was created specifically to check that the insertion
of characters and words in the Editor.edits vector works properly.
* Replace doctest with unittest
This does not require exposing private functionality as pub
* Fix naming according to #160
Co-authored-by: sholderbach <ho.steve@web.de>
* Fix CtrlD/CtrlC and reverse-history-search + stuff
- `Ctrl+C` and `Ctrl+D` did not work after the changes in #138 and #146
- Fixed by only registering the `ReedlineEvent` and defering
potentially necessary edits to the `handle_event` stage
- Defined their behavior for the reverse history search
- Corrected interactions with undo (as best as I could understand it)
- Reverse history search did not allow for browsing through its results
- Fixed `handle_history_search_event` and simplified the cases
- Register undo steps for the reverse history search (when entering and
leaving via enter)
- Added comments to similar sounding methods and variants (UPDATE IF
NECESSARY!)
- Moved the repaint stuff closer together in engine.rs for better
readability
- Noncritical stuff that caught my eye
* Test first/last line detection