Skip to content

Commit 3bf0879

Browse files
committed
feat: add inline previews for selected completions
Replace opt-in cycle insertion with a default display-only completion preview, configurable with --preview. Emphasize matched input and share one mapping for cursor placement and mouse positions without editing the buffer during preview. Accept and submit the selected completion with one Enter press when previews are enabled. Disabling previews restores two-step Enter: accept, then submit. Keep Right/End acceptance aligned with the visible candidate and prevent hidden history suggestions from taking precedence. Preserve shared-prefix expansion and unique-match acceptance. Map Unicode case expansions back to original input and candidate coordinates. Traverse the ordered display mappings once during rendering. Cover Unicode, quotes, escaped filename spaces, mouse clicks, cancellation, selection stability and resizing. Document basic usage in the completion section. Validation: 1089 library tests passed (1 ignored), 28 Bash PTY scenarios passed, formatting and Clippy passed, release build and documentation completed. Documentation retains existing rustdoc warnings.
1 parent f0ab3d0 commit 3bf0879

10 files changed

Lines changed: 1216 additions & 473 deletions

File tree

‎README.md‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,18 @@ Flyline extends Bash's tab completion feature in many ways.
454454
Note that you will need to have [set up completions in normal Bash first](https://github.com/scop/bash-completion).
455455

456456

457+
### Completion previews
458+
459+
Selected completions appear in italics in the command line, with characters matching your input in bold.
460+
Use Tab to browse, Enter to accept and run the command in one press, or Escape to dismiss the preview.
461+
462+
Previews are enabled by default. Disable them to restore two-step Enter (accept, then run):
463+
464+
```bash
465+
flyline --preview false # disable
466+
flyline --preview # enable
467+
```
468+
457469
### Intellisense style auto suggestions
458470
Flyline can automatically start tab completion suggestions as you type. This demo shows auto-started suggestions, confirming a suggestion, dismissing with Escape, and submitting the command.
459471

@@ -803,18 +815,6 @@ If `tabCompletionAvailable` is false, then it will try the next keybinding for `
803815
The `always` context variable is always true.
804816
For tab completion, `tabCompletionOneResult` is true when there is exactly one tab completion result.
805817
806-
The `tabCompletionCycleInsert` action writes the highlighted suggestion into the buffer instead of only highlighting it, and repeating it replaces that text with the next suggestion (`menu-complete` in other shells).
807-
It is opt-in: without these bindings Tab keeps its default behavior.
808-
Typing or moving the cursor ends the cycle; `tabCompletionInserted` lets Enter submit text already inserted.
809-
810-
```bash
811-
flyline key bind Tab 'editingBufferMode=tabCompletionCycleInsert'
812-
flyline key bind Tab 'tabCompletionBackgroundActive=tabCompletionCycleInsert'
813-
flyline key bind Tab 'tabCompletionWaiting=tabCompletionCycleInsert'
814-
flyline key bind Tab 'tabCompletionAvailable=tabCompletionCycleInsert'
815-
flyline key bind Enter 'tabCompletionInserted=submitOrNewline'
816-
```
817-
818818
Flyline provides useful tab completions to help you write keybindings.
819819
820820
#### List keybindings

0 commit comments

Comments
 (0)