* Gracefully handled lack of system clipboard
If the `system_clipboard` feature is enabled, but we failed to
initialize the `SystemClipboard`, default to `LocalClipboard` instead of
panicking.
* Remove `eprintln!()` when failing to access system clipboard
* get correct cursor pos when menu indicator contains newline
* add tests
* fix cursor pos in multiline prompt
* make description mode enum public
* add doc comment
* respect windows newline in update_values
* Revert "respect windows newline in update_values"
This reverts commit 070d600545.
* add complete_with_base_ranges to Completer
* add builder for correct_cursor_pos
* add config options to completion examples
* Fix file based history when capacity is set to zero
Signed-off-by: Andrei Stan <andreistan2003@gmail.com>
* Fix CI
Signed-off-by: Andrei Stan <andreistan2003@gmail.com>
---------
Signed-off-by: Andrei Stan <andreistan2003@gmail.com>
* Add ability to select and cut text in the input buffer
* Add visual selection effect
* Add SelectMoveWord<Left/Right> command on Shift + Ctrl + Arrow
* Add ability to delete selection with EditCommands 'Delete' and 'Backspace'
* Make selection an option on every move EditCommand
* Add display text for optional 'select' parameter to move EditCommands
* Don't slice line in DefaultCompleter
* Revert completions example
* Fix clippy lint
* Treat input as '' if None
* Update values even if string_difference empty
* Rename start to pos in list_menu
* Fix string_diff bug with repeated char
* Trim before completing in DefaultCompleter
* Remove TODO
* Make HistoryCompleter take end as pos
* First shot at resolving the resizing issues with terminals
* Comment for known bug
* Checking the start row repeatedly to see how it affects performance
---------
Co-authored-by: Daniel Somerfield <daniel.somerfield@hatchdata.com>
* Exclude the clipboard feature for docs.rs builds
The 0.27.0 docs.rs build failed as the `xcb` crate build.rs failed in
the docs.rs sandbox.
Exclude the clipboard feature for now and only enable:
- `bashisms`
- `external_printer`
- `sqlite` (should be pretty similar to `sqlite-dynlib`)
* Fix hyperlink formatting
* Manually mention required features
* Make history-related items (de-)serializable
* Fix: remove duplicate derive
* Fix: deserialization bound on generic type parameter
* Comment on the custom deserialize_with attribute
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>