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
* Ignore tarpaulin coverage build folder and html report
* Add tests for line buffer
* Capitalize char only moves a character to right
* Uppercasing and lowercasing words works
* Fix the swap grapheme function
I have made this to be close to what I inferred the intent to be. I
really think we should probably have two functions which do this:
`swap_grapheme_left` and `swap_grapheme_right` which work in the
mentioned direction.
* Fix swap words
Swap words only swap words and there is no change in position.
* Add equality derive for EditCommand and ReedlineEvent
* Move matches to keybinds for emacs edit mode
* Simplify event matching in emacs edit mode
* Bugfix: All matches happening at same point
* Add failing test to check keybinding override
* Bugfix: Inserting capital character works
* Unknown requirement: test to be to capture currently unknown requirement
* Add rstest
The reason is to easily write parameterized tests
* Add test: for emoji input to emacs
* Add tests and fixes for vi edit mode
* Reedline None event and vi keybinds
* Keybindings are overridable
* Vi Reedline::None
* Extract hinter and highlighter out of Painter
* Cleanup unused variables, add comments
* Remove AppendToHistory Event
* Keybindings talk in terms of ReedlineEvent
* Add placeholder docs
* Push History handling one-level up
* Modify Enter handling to match others
* Extract Previous and Next History commands from EditCommand to ReedlineEvent
* Remove reduncant EditCommand -> ViFragment
* Pull Up/Down from EditCommand to ReedlineEvent
* Pull SearchHistory from EditCommand to ReedlineEvent
* Refactor insertion wrapping code
* Push History handling one more level up
* Fix doc test: keybind interface change
* Remove redundant indirections
* Reorganize methods in engine
* Update vi binds from history to up/down operations
* Remove the hacky EditInsert brach from ReedlineEvent
* Remove vagueness from position method
* Pull terminal size into the main struct
* WIP: prompt widget
* Remove a bunch of stuff
- clock
- vi stuff
- requirement to do full repaint state management
* Remove edit mode from event matcher
* Extract out event handling into a function
* Add reedline specific enum
* Rebase fixes
* Update docs
* Re-add clock functionality
* Add event-parser
* Pull out Input Parsing out of the main struct
* Move input parsing stuff into a directory
* Move vi stuff into input parsing
* Re-introduce Vi-Mode
* Remove EditMode enum
* Emacs mode uses non-default keybindings
* Basic hygine for edit_mode
- Rename: input_parsing to edit_mode
- Rename: EmacsInputParser to Emacs
- Rename: ViInputParser to Vi
- Rename: InputParser to EditMode
- Add docs: EditMode
- Add docs: Vi
- Add docs: Emacs
* Remove update_keybindings interface
* Vi sends Repaint events on mode switch
* Rename new to create
* Organise tab handling into files
* Concretise assumptions as manul tests
* Add expectation (failing test)
* Store one-level history for tab handler
* Remove reset index from the public interface of TabCompletion
* Update note on cycling though the tab-completions