Repository navigation
feat: add inline previews for selected completions - #1051
Victor-Loos wants to merge 2 commits into
Conversation
|
Little video of what it looks like? |
|
Here’s a quick demo. Pressing Tab now puts the selected completion directly into the command line. Press Tab again to cycle through the other matches, then Enter to run the command. This behavior is opt-in through key bindings. flyline-tab-demo.mp4 |
|
This is a cool idea and thanks for the demo. Ive tried out your branch and I think it would make more sense to implement this feature like so:
|
Add an opt-in tabCompletionCycleInsert action that writes the selected candidate into the command buffer and replaces it on subsequent Tab presses. Expose tabCompletionInserted so Enter can submit a candidate already present in the buffer. Scope insertion requests to the active completion and invalidate them on edits, cursor movement or selection changes. Preserve the selected candidate as more results arrive or the grid changes shape, and use the complete inserted span when accepting one or all candidates. Document the bindings and add unit and Bash PTY regression coverage for cycling, navigation, cancellation, editing, Unicode, undo and resizing. Validation: - cargo test --workspace --lib --locked - cargo fmt --all -- --check - cargo clippy --workspace --all-features --locked -- -D warnings - cargo doc --workspace --no-deps --document-private-items --locked - cargo build --release --locked - python3 tests/tab_cycle_pty.py --flyline target/release/libflyline.so
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.
efc74f6 to
3bf0879
Compare
|
The selected completion now appears as an italic inline preview by default, configurable with Behavior and implementation:
The rendering logic is isolated in |
Add an opt-in tabCompletionCycleInsert action that writes the selected candidate into the command buffer and replaces it on subsequent Tab presses. Expose tabCompletionInserted so Enter can submit a candidate already present in the buffer.
Scope insertion requests to the active completion and invalidate them on edits, cursor movement or selection changes. Preserve the selected candidate as more results arrive or the grid changes shape, and use the complete inserted span when accepting one or all candidates.
Document the bindings and add unit and Bash PTY regression coverage for cycling, navigation, cancellation, editing, Unicode, undo and resizing.
Validation: