* Show content after cursor when completing
Currently the content after the cursor was completely omitted when
entering the completion menu
Addresses it for the simple case of everything fitting on the screen
Question what should take priority if the entry and menu together exceed
the hight of the screen remains open!
* Place the hint obligatory behind the line content
In line with the behavior in fish and zsh autosuggestions hints are
displayed after the line.
Next step would be to make the DefaultHinter/Hinter trait conformant to
this behavior and also allow history hint suggestions based on the whole
line content, while editing inside the line.
* Simplify hinter internals/capabilities
DefaultHinter now only supports history
Requires no copies of the whole history anymore
* Remove `HistoryCompleter` (was never pub)
* Fix doctest `Reedline::with_hinter`
* Add configurable character threshold for Hinter
Only hint if a certain number of characters has been typed
Default: 1
As this function can only be called outside running
`Reedline::read_line` it is not relevant for raw mode reasons and can be
replaced by standard `println!()`
In the hinter logic `LF` was always replaced by `CRLF` thus inserting unnecessary `CR`'s into the linebuffer that accumulate if a multiline entry is recalled via hint autosuggestion from history multiple times.
Carriage returns, that are not introduced at the end of the line as part of the painter or the OS convention, break the painting of multilines, as the cursor position might jump to the start of the multiline continuation prompt and start painting from there!
* Move running of EditCommands to the editor
- Moves the big match statement for `EditCommand`s into `Editor`
- Removes the need for many `pub` wrappers around the `LineBuffer`
- Make `Left` a `ReedlineEvent` as well
- Fix left, right, up, down for vi mode
* Fix left move in vi insert mode
* support double prompt
* clippy warning
* better cursor position
* Move to estimating the right prompt cutoff
* refactor to use line_width
* refactor to use line_width
Co-authored-by: Fernando Herrera <fernando.j.herrera@gmail.com>
* test big buffer
* clippy error
* more clippy corrections
* extra else for position
* debug cursor
* moving to debug section
* hints in big buffer
* case for prompt one line
* corrected extra line
Fixes `history_search_paint`:
- Fix unnecessary clear of single line
- Ensure LF to CRLF in search results
Fixes `Painter`:
- Make sure that Color is cleared after prompt (Currently depends on
Highlighter to provide a new color)
- Remove unnecessary fn
Introduce simple highlighting of the search term in the search result:
- Introduce `SingleMatchHighlighter` that will highlight all matches of
the search string
- Rename `DefaultHighlighter` to `ExampleHightlighter` as the behavior
seems not very useful for default use.
- Extract styling operations into styled text
* Add issue templates
As we often have to consider certain platform/terminal editor specific things as potential sources of bugs, let's nudge people to provide this info
* Delete githubs default form
There are latent concerns about unicode correctness, but as long as
crossterm/hints are providing correct chars/strs this is neither a security risk
(no unchecked/unsafe string ops on our side) nor
a DoS risk.
- Made move up and move down unicode safe
- Added the option to constrict the char search (vi `f` `F` `t` `T`) to
the current line as usual in vi
- Improved test coverage
* prompt moves based on hint
* checked sub for the prompt
* checked sub for the prompt
* using promplines
* clean flush
* split lines before print
* test with full print
* test with full print
* removed flush
* no split
* drawing function with prompt
* replacing space return to string
* history search in repaint buffer
* using last row
* removed extra required lines
- current line detection was off on the first position of a following
line
- find_current_line_end was not correctly aware of CRLF platforms
- Increase of coverage for some old functions
- Moves to start and beginning of the line
- Make start and end of buffer available for move via `Ctrl-Home` and
`Ctrl-End`
- Support vi style cutting of whole lines in the cut buffer.
- add vi style `p` after paste in addition to before cursor paste with
`P` or in emacs mode
- Enables vi style `dd` and paste
- Make sure the line to end cut and clear operations work only on the
line
* Disable hints during history traversal
Additional autosuggestion (history) hints are confusing while
navigating through the history.
Example history:
```
hello test
hello
something else
hello world
whatever
```
- Type `h`
- Press up arrow
- Prefix based history search will return `hello world`
- Press up arrow again
- Previously `hello <hint>world</hint>` now just `hello`
* Reduce code duplication before painting
* Move history newline escape to the file IO
Avoids potential interference with history search, makes
`History::iter_chronologic` nice again, simplifies it regarding hints
and should address the `history` command in a better way.
+ Extract escape
+ Remove unwrap
* Remove unnecessary optional history allocation
No need to clone if entry is duplicate or empty
* Offset setting changes
* Rename `PromptWidget` to `PromptCoordinates`
* Explicit setters
* Set offset implicitly on `full_repaint`
* Rename origin and offset
As suggested by JT
origin -> prompt_start
offset -> input_start
* Move tracking of offsets and size into painter
Relatively basic refactor of all tracking of prompt/input offsets as
well as the terminal size into the painter.
Some cooperative behavior in the engine is still required
Wrapping handler is currently still a crutch in the engine as it is not
`InsertChar` specific and should be handled for every buffer change
instead
* Simplify restore from history stearch
Prompt is simply updated via full repaint
* Fix ansi coloring for history prompt
also ignore reset color in non ansi colored mode
* Make pedantic clippy happier
* Ensure prompt creation is tight and not wrapping
Fix additional line that is created upon prompt creation if the previous
output was printing a new line. Also ensures that line clearing and
regular prompt creation at the bottom of the screen doesn't cause
scrolling issues (Currently a hardcoded solution for the two line
prompt)
Also reduces the API surface for tools only necessary to deal within raw
mode.
* Fix doctests for internals removal
`print_crlf()` was removed from the public API as it should only be used
in raw mode for internal stuff.
As soon as we leave `Reedline.read_line()` raw mode should be disabled
and the regular print macros should work as expected