Commit Graph

516 Commits

Author SHA1 Message Date
Jakub Žádník
a46c41cfa3
Update nu-ansi-term to 0.50.0 (#716) 2024-01-22 21:22:00 +02:00
andreistan26
d9db6a84b7
Fix panic when history size set to 0 (#653)
* 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>
2024-01-20 19:25:02 -08:00
Michael Angerman
7255741290
remove codecov.yml in the reedline repo (#710)
* remove codecov.yml

* remove uploading code coverage in the ci.yml

* add back in codecov.yml and see if just removing the action in the ci.yml works
2024-01-20 19:08:49 -08:00
maxomatic458
9ca229de32
get correct cursor pos when menu indicator contains newline (#708) 2024-01-20 13:17:29 -06:00
maxomatic458
a3769f9b98
respect windows newline in update_values (#709) 2024-01-20 12:17:53 -06:00
maxomatic458
31eaeeb231
ide style completions (#696)
* ide style completions

* descriptions

* truncate suggestion & description

* border width

* clippy & typos

* run cargo fmt

* add with_description_offset to builder

* fix empty description

* minimize description padding

* rework working details handling + fix CI

* add tests + change split function

* fix multiline prompt cursor pos
2024-01-18 10:37:06 -06:00
Tastaturtaste
2f3eb3e82f
Add ability to select and cut text in the input buffer (#689)
* 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
2024-01-17 12:03:42 -06:00
Tastaturtaste
dc27ed8ff4
Replace clipboard with arboard, which is actively maintained (#705) 2024-01-14 17:59:59 -06:00
Darren Schroeder
ef7b96c157
Revert "Fix move to line start in multi-line history entries" (#704) 2024-01-11 15:41:29 -06:00
Yash Thakur
0c5f981746
Don't slice line in DefaultCompleter (#695)
* 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
2024-01-11 10:13:20 -06:00
Yash Thakur
3e2c0fef3b
Print after cursor until newline (#700) 2024-01-11 09:29:07 -06:00
Mark Murphy
7404f70bf7
Fix move to line start in multi-line history entries (#584)
* Add move-to-line-start tests

* Fix #582 edit commands jumping to end of buffer after history navigation

* Fix formatting
2024-01-11 08:16:06 -06:00
Clément Nerma
b2f265014d
Make ReedlineErrorVariants public (#679)
* Make `ReedlineErrorVariants` public

* Fix: add missing comments
2024-01-11 08:11:58 -06:00
Jakub Žádník
b8ea490243
Bump version for 0.28 release (#702) 2024-01-09 21:05:36 +02:00
WindSoilder
b68ce33c75
Try fix prompt_start_row reset to 0 when opening a file without newline in Nushell (#697)
* adjust is_reset

* add a word

* Revert "add a word"

This reverts commit e61be57724.
2024-01-05 16:37:52 -06:00
WindSoilder
aa101f4d69
fix clippy, add typo dict (#698) 2024-01-04 07:44:18 -06:00
Stefan Holderbach
f3962232ba
Fix clippy from the future (#687)
- `get_first`
2023-12-26 17:00:40 +01:00
Stefan Holderbach
1c17a8d0f2
Bump itertools to 0.12.0 from 0.10.x (#686)
Most recent version of itertools.
Used by nushell crates.
Several crates in the ecosystem are still working with `0.11.0`
2023-12-26 17:00:15 +01:00
nibon7
e097b88dab
Fix prompt_start_row reset to 0 after output without CR (#688) 2023-12-23 17:52:40 +01:00
Daniel Somerfield
a4bfaa512b
Better behaviour on resize (#675)
* 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>
2023-12-15 11:18:05 -06:00
Stefan Holderbach
0046da98b5
Bump version to 0.27.1 (#683) 2023-12-14 18:43:08 +01:00
Stefan Holderbach
ea83904b89
Try to fix the docs.rs build (#682)
* 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
2023-12-14 18:38:13 +01:00
Stefan Holderbach
63139b84fc
Bump version for 0.27 release (#681) 2023-12-13 06:16:12 +13:00
Steven
ff5fdb0e10
vi mode: map cw/cW to ce/cE by default (#668) 2023-12-06 18:46:29 +01:00
Clément Nerma
43944ee99d
Make history-related items (de-)serializable (#678)
* Make history-related items (de-)serializable

* Fix: remove duplicate derive

* Fix: deserialization bound on generic type parameter

* Comment on the custom deserialize_with attribute
2023-12-06 07:31:54 -06:00
Clément Nerma
ca2f6c8c10
Allow to build HistoryItemId values from the outside (#677)
* Allow to build HistoryItemId values from the outside

* Fix: add missing documentation on HistoryItemId::new
2023-12-06 07:25:50 -06:00
Clément Nerma
07b7f6bb76
Allow to construct ReedlineError values from the outside (#676) 2023-12-06 07:17:18 -06:00
Stefan Holderbach
37714c922e
Build docs.rs docs with all features (#672)
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
2023-11-29 10:39:57 -06:00
Stefan Holderbach
93af55c2eb
Bump version for 0.26.0 release (#664) 2023-11-14 20:20:55 +01:00
Stefan Holderbach
879272643f
Properly handle optional event modes (#659)
* 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
2023-11-14 19:53:13 +01:00
Hofer-Julian
63c43a9a6b
Also run clippy on examples (#666)
* 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>
2023-11-14 11:40:28 +01:00
Chinmay Dalal
d9e0a326df
CwdAwareHinter: remove cwd filter when there are no results (#656)
* CwdAwareHinter: remove cwd filter when there are no results

* remove panicking functions
2023-11-13 13:59:42 +01:00
Clément Nerma
01e32dae88
Add more derive impl for HistoryItemId (#662) 2023-11-11 16:04:55 -06:00
Clément Nerma
16ac4411f0
Make Result and ReedlineError public (#661)
* Make `Result` and `ReedlineError` public

Allows implementing custom `History` types

* Fix: style

* Add rustdoc for reedline::Result
2023-11-11 15:35:20 -06:00
Rein Fernhout
c853d71e66
re-enable bracketed past on not(windows) (#657) 2023-11-06 14:36:11 -06:00
Darren Schroeder
7ca3c388b9
don't allow certain examples to compile without their features (#658) 2023-11-05 14:31:24 -06:00
stfacc
60b3b62743
Split hinter tokens at Unicode word boundaries (#650)
* 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
2023-11-02 00:37:42 +01:00
Dan Gohman
2b6790c14b
Avoid consuming CPU when waiting for input. (#651)
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.
2023-11-02 00:37:22 +01:00
Chinmay Dalal
973dbb5f5f
add cwd aware hinter (#647)
* 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
2023-10-19 22:41:09 +02:00
Stefan Holderbach
adc20cb371
Bump version for 0.25.0 release (#645) 2023-10-16 20:03:20 +02:00
Stefan Holderbach
fb9337dccb
Fix clippy lint from most recent Rust (#646)
https://rust-lang.github.io/rust-clippy/master/index.html#/format_collect
2023-10-15 21:17:18 +02:00
Horasal
b1344f6a65
Accept Command with args for BufferEditor (#630)
`.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>
2023-09-28 16:42:05 +02:00
Stefan Holderbach
0bf57feba3
Update motto title (#640)
This should reflect that we do not strive to be a `readline` replacement and have our own opinionated choices.
2023-09-28 14:34:01 +02:00
Stefan Holderbach
fd73d0413c
Bump version for 0.24 release (#638) 2023-09-19 14:42:08 +02:00
Hofer-Julian
f993939690
Improve history isolation (#634)
* 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`
2023-09-17 15:45:38 -05:00
Stefan Holderbach
ebd653b840
Remove old actions-rs/cargo (#637)
See: https://github.com/actions-rs/toolchain/issues/216
2023-09-15 13:17:01 +02:00
Stefan Holderbach
ae1d97a384
Add a configuration to codecov.io (#636)
* Add a configuration to codecov.io

* Add badge

* Make coverage purely informational
2023-09-15 11:15:02 +02:00
Stefan Holderbach
6739c6aed4
Setup coverage with codecov.io (#635) 2023-09-15 10:43:07 +02:00
ysthakur
33828e5821
Add support for a different prompt after submission (#627)
adds a separate `transient_prompt` to be displayed after submitting.
2023-09-12 22:36:01 +02:00
Hofer-Julian
b2b8f3f486
Minor improvements (#633) 2023-09-10 11:31:32 +02:00