Inspired by https://github.com/nushell/nushell/pull/11180
Make sure you can see all available types/symbols on docs.rs
(e.g. `SqliteBackedHistory`)
In a second step we should take care of annotating feature gated stuff
correctly
* 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>
* Split hinter tokens at Unicode word boundaries
Partial completion behaves now like usual word movements by C-Left and C-Right.
* Refactor helper functions to crate level
When reading input, start by calling `event::read`, which efficiently blocks
until input arrives, rather than polling for input every 100
milliseconds.
This preserves the existing `POLL_WAIT` polling behavior by moving the
poll after the first `read` call returns.
Fixes#521.
* 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 use_kitty_protocol support option
* move pop key enhancement flags just before loop exit
* add pop keyboard flags pop on drop
* remove toggler functions' return
* move pop key enhancement flags beside other mode change
Replace scrolling via escape sequence with workaround that prints newlines to retain scrollback
regardless of terminal implementation of scroll sequence
- `strum`/`strum_macros` enables upgrade to `syn 2.0`
- `pretty-assertions` gets rid of `ctor` and other outdated dev-deps
- `rstest` also helps with `syn` but introduces `regex` dev-dep
* fix: prompt position on resize
* fix: u16 overflow
* fix: prompt position when terminal grows in height
* fix: exclude blank area from prompt height
fix: resume the early return to exclude a case where the terminal got smaller but the prompt is still visible
* fix: prevent any line overwriting at the cost of duplicate prompts
* fix: prevent width change from eating previous output