Skip to content

Fix some small bugs in ledger-complete-at-point#472

Open
bcc32 wants to merge 5 commits into
ledger:masterfrom
bcc32:fix-cap-bugs
Open

Fix some small bugs in ledger-complete-at-point#472
bcc32 wants to merge 5 commits into
ledger:masterfrom
bcc32:fix-cap-bugs

Conversation

@bcc32

@bcc32 bcc32 commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Previously, completion in ledger-mode had the following unintuitive behaviors:

  1. TAB sometimes changed the account or payee at point to a different one, even
    if the one at point was a valid completion (such as declared in a directive
    or appeared elsewhere in the buffer)

    This is fixed by changing how the thing being completed is excluded from the
    completion results (by position, instead of by filtering the final list of
    strings).

  2. TAB in the middle of a payee name or transaction comment would insert a
    completion immediately before point without deleting the contents after
    point.

    This is fixed by correcting the END boundary returned by the capf, such that
    it includes the suffix of the thing being completed.

The intermediate commits contain failing tests which are marked accordingly.
The subsequent commits fix those bugs and update the expected result.

bcc32 added 5 commits June 7, 2026 15:57
Instead of unconditionally removing the string at point from the completions
list, the correct approach is to skip the occurrence at point while scanning the
buffer.  If the same string appears in other transactions/postings not at point,
it is a valid completion and should be offered as such (and, e.g., prevent TAB
from needlessly changing the contents).
@bcc32 bcc32 requested a review from purcell June 8, 2026 02:50
@bcc32 bcc32 linked an issue Jun 8, 2026 that may be closed by this pull request
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.

Account completion table includes account at point

1 participant