Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C-c C-c ledger-toggle-current searches backwards indefinitely #374

Closed
jstamant opened this issue Sep 25, 2023 · 3 comments
Closed

C-c C-c ledger-toggle-current searches backwards indefinitely #374

jstamant opened this issue Sep 25, 2023 · 3 comments

Comments

@jstamant
Copy link
Contributor

jstamant commented Sep 25, 2023

If the cursor isn't on a transaction, hitting C-c C-c (ledger-toggle-current) will search backwards until it finds a transaction, and then toggles its state.

The behavior is the same as in issue #316, where I explain this problem in a bit more detail. Like in #316, my suggestion here is to add some validation that only lets a user perform ledger-toggle-current when point is on a valid transaction or posting.

I'll probably provide a fix in a PR shortly.

@bcc32
Copy link
Collaborator

bcc32 commented Mar 23, 2024

I can't reproduce this behavior. There have been a couple recent changes to ledger-toggle-current's implementation, so it might be fixed by now?

Can you provide a sample ledger file and a step-by-step reproduction example?

@jstamant
Copy link
Contributor Author

Hey, Aaron. Gladly:

Upgrading ledger-mode to today's version on MELPA (20240322.2155) still produces the behavior for me.

Steps to reproduce

  1. Download this sample file and open it with ledger-mode as the major mode
  2. Goto to line 6 and hit C-c C-c (ledger-toggle-current)
  3. Notice that the transaction above gets toggle. If this were a long section of comments, the command would silently occur.
  4. Add a full window's worth of newlines at line 4 so that the transaction is no longer on screen
  5. Goto the end of the file M-x end-of-buffer, and run M-x ledger-toggle-current again
  6. Notice that the status for the transaction on line 1 get toggled. Silently

bcc32 added a commit to bcc32/ledger-mode that referenced this issue Mar 24, 2024
bcc32 added a commit to bcc32/ledger-mode that referenced this issue Mar 24, 2024
@bcc32
Copy link
Collaborator

bcc32 commented Mar 24, 2024

Ah, thanks for the example. It turns out I also had to set ledger-clear-whole-transactions non-nil to trigger the bug. Fixing

@bcc32 bcc32 closed this as completed in 34a7430 Mar 24, 2024
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 a pull request may close this issue.

2 participants