* Properly handle optional event modes
Both bracketed paste and the kitty keyboard enhancement flag are not
always supported.
This goes both for terminals that may not emit events according to their
spec and also applications that will run in the terminal independent of
reedline.
Make sure we enter the mode when starting to take control and exit the
mode when leaving the mode or being dropped.
The settings exposed to the user will just internally enable a setting
(in the case of the kitty keyboard enhancement flags crossterm provides
and easy way to check for support that we take into account with that)
* Adjust demo to sane bracketed paste API
* cargo fmt
* Add a static helper `kitty_protocol_available`
Public as `reedline::kitty_protocol_available`
Replace the method `Reedline::can_use_kitty_protocol` that doesn't
depend on `Reedline` in the future
Rewrite `KittyProtocolGuard` in terms of it.
* Remove `Reedline::can_use_kitty_protocol`
* Add builder style setters for terminal enhancement
* Switch demo to bracketed paste via builder
* Expand `use_kitty_keyboard_enhancement` doccomment
* Remove old terminal enhancement APIs
* Use `use_kitty_keyboard_enhancement(true)` in demo
As we internally check whether it is available, this should be fine in
nearly all terminals (if they can safely be probed)
* Fix typo
* Also run clippy on examples
This PR also fixes existing clippy lints
* Update .github/workflows/ci.yml
---------
Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
* add cwd aware hinter
towards https://github.com/nushell/nushell/issues/8883
* handle the case where get_current_dir returns Err
* WIP cwd aware hinter
- guard CwdAwareHinter with feature flag
- remove references to fish from DefaultHinter as fish is cwd aware
- add example
* document that CwdAwareHinter is only compatible with sqlite history
* handle non-sqlite history
* handle no sqlite feature in example
* fix warnings
`.with_buffer_editor()` now expects a `std::process::Command` that can be provided with additional arguments and a tempfile that is unique.
---------
Co-authored-by: Horasal <horsal@horsal.dev>
Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
* Improve history isolation
After this change we will get rows:
- that have the same session_id, or
- have a lower id than the first command with our session_id, or
- if there's no command with our session_id, take the whole history.
* Enforce history_isolation also for hints
* Store the session_timestamp in `SqliteBackedHistory`
* add `HistoryFilter` and use it in engine, to allow not storing items with a given prefix
* use `with_history_exclusion_prefix` in demo
* review
* impl history filter on engine
* keep 1 filterered history item
* don't impl History on Box<T: History>
* make multiline prompt color configurable
* remove unnused use statements
* minor comment update
* Clippy fix
new lints from rust 1.67
* Cargo fmt
---------
Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
* custom validator and prompt
* Split prompt and validator demo into two files
Also add info text when running
Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
* Split the main example binary into examples
Separate fully featured demo from keybinding listing and event listener
Allows to make `gethostname` dev-dependency
* Clippy fix in examples
Addresses #320, #236
* Adding External printer
* Made ExternalPrinter as an optional feature. Clippy is happy, test pass, docs added.
* ExternalPrinter: prints multiple messages if available, more on error-handling.
* Bug(s) fixed. Prints messages. Working example in examples folder. Code formatted, clippyed, tests pass.
* Generic ExternalPrinter<T> where T: Display.
* Fixed: Works with buffers larger than a line.
* Fixed: Works with buffers larger than a line, refactored.
* Different approach, seems to look like what is expected. Gives the "illusion" of one line being entered. Needs more testing, could have some off by one errors ;)
Co-authored-by: Gregor Engberding <gregor@meinkopter.de>