Skip to content

Merge open contributions: history fix, paste transformer, inline suggestions#115

Merged
maxlandon merged 4 commits into
masterfrom
dev
Jul 5, 2026
Merged

Merge open contributions: history fix, paste transformer, inline suggestions#115
maxlandon merged 4 commits into
masterfrom
dev

Conversation

@maxlandon

Copy link
Copy Markdown
Member

Bundles the reviewed open contributions onto dev, recommitted as signed commits with original authorship preserved.

Included

  • fix(history): return an error from memory.GetLine on out-of-range index (fix(history): return an error from memory.GetLine on out-of-range index #111, @SAY-5, fixes History panic: runtime error: index out of range [1] with length 1 #110)
    The in-memory history source now returns errNegativeIndex/errOutOfRangeIndex instead of panicking, matching the file-backed source's contract. All GetLine callers already treat the error as recoverable.

  • Add a bracketed paste transformer hook (Add a bracketed paste transformer hook #113, @M09Ic)
    New exported Shell.PasteTransformer field, letting applications rewrite a normalized paste payload before insertion (e.g. replace it with a [Pasted text #1 +6 lines] placeholder). Empty result inserts nothing. Merged with the SetPasteTransformer method dropped — the bare field matches the SyntaxHighlighter/Completer convention.

  • Add inline suggestion display API (Add inline suggestion display API #114, @M09Ic)
    Shell.SetInlineSuggestion/ClearInlineSuggestion/GetInlineSuggestion render application-provided ghost text after the cursor (AI predictions, remote completions, …), gated to line-end with a prefix match. History autosuggest keeps priority.

  • feat(inline): commands to accept inline suggestions (new)
    Adds the missing input side for the display API:

    • inline-suggest-accept — accept the whole suggestion.
    • inline-suggest-accept-word — accept the next word.
    • forward-char / vi-forward-char fall back to accepting an inline suggestion at line-end when history autosuggest accepted nothing.
      Acceptance logic lives in internal/display; thin *Shell command wrappers in the root package.

Testing

  • go build ./..., go vet ./..., and go test ./... all pass.
  • New unit tests in internal/display and end-to-end tests in the root package.

Wiki updated separately: command reference plus new Inline Suggestions and Bracketed Paste pages.

Closes #110. Supersedes #111, #113, #114.

SAY-5 and others added 4 commits July 5, 2026 22:56
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
…estions

The inline suggestion API (Shell.SetInlineSuggestion) is display-only: it
renders ghost text but offers no way to accept it into the buffer. Add the
missing input side, mirroring the history autosuggest acceptance model:

- inline-suggest-accept: accept the whole suggestion.
- inline-suggest-accept-word: accept the next word (forward-word semantics).
- forward-char / vi-forward-char fall back to accepting an inline suggestion
  at end of line when history autosuggest accepted nothing, so an existing
  binding accepts either kind of ghost text.

Acceptance follows the same gate as the display: cursor at line end and the
suggestion extending the current line. History autosuggest keeps priority.
@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.26733% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.04%. Comparing base (088046b) to head (f8270f3).

Files with missing lines Patch % Lines
shell.go 54.54% 5 Missing and 5 partials ⚠️
internal/display/engine.go 74.07% 7 Missing ⚠️
internal/display/refresh.go 33.33% 3 Missing and 1 partial ⚠️
emacs.go 81.81% 2 Missing ⚠️
internal/display/inline.go 92.59% 1 Missing and 1 partial ⚠️
vim.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #115      +/-   ##
==========================================
+ Coverage   38.33%   39.04%   +0.71%     
==========================================
  Files          59       60       +1     
  Lines        9516     9606      +90     
==========================================
+ Hits         3648     3751     +103     
+ Misses       5785     5767      -18     
- Partials       83       88       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maxlandon maxlandon merged commit be2926f into master Jul 5, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

History panic: runtime error: index out of range [1] with length 1

3 participants