Skip to content

Conversation

@TobiasLaross
Copy link
Contributor

@TobiasLaross TobiasLaross commented Nov 3, 2025

Description

This PR implements goto_next() and goto_previous() navigation functions as requested in #20. These functions allow programmatic navigation between marks without relying on the UI picker or static keybindings. They use the closest mark within the current file as the current reference position and apply wrap-around navigation when reaching the start/end of the list. This enables plugin authors and advanced users to build custom navigation workflows and integrate marksman’s mark navigation into other tools.

Type of Change

  • New feature (non-breaking change which adds functionality)

Testing

  • Tests pass locally (just test)
  • Added new tests for this change
  • Tested manually in multiple scenarios

Describe specific testing done:

  • Added goto_next and goto_previous tests including wrap-around
  • Verified navigation works when cursor is on a mark, near a mark, and in files with multiple marks
  • Verified correct fallback behavior when no marks are in the current file
  • Confirmed sensible error behavior when fewer than two marks exist

Breaking Changes

None. This is a new API surface and does not affect existing commands or keymaps.

Checklist

  • Code follows style guidelines (just lint passes)
  • Code is formatted (just format applied)
  • Self-review completed
  • Documentation updated (added brief usage notes where appropriate)
  • No console logs or debug code left behind

Additional Notes

Resolves #20

@alexekdahl
Copy link
Owner

Noticed there’s some missing test coverage for a few important scenarios - marks spread across multiple files, cases where the cursor is between marks (e.g., line 5 with marks on lines 1 and 10), and when goto_next() is called from a file with no marks. Let me know if you’d like any pointers on adding these tests - happy to help!

@alexekdahl alexekdahl self-assigned this Nov 3, 2025
@TobiasLaross TobiasLaross force-pushed the feature/goto-next-previous branch from c74f07b to 7bfedc1 Compare November 4, 2025 06:37
@alexekdahl alexekdahl self-requested a review November 4, 2025 09:15
@alexekdahl alexekdahl merged commit 37fd8f6 into alexekdahl:main Nov 4, 2025
2 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.

[FEATURE] Expose "Goto Next" and "Goto Previous" APIs

2 participants