Skip to content

Add opt-in click-to-jump-to-entry in multiple entry edit mode - #112

Merged
sdercolin merged 3 commits into
devfrom
feature/click-to-jump-to-entry
Jul 10, 2026
Merged

sdercolin merged 3 commits into
devfrom
feature/click-to-jump-to-entry

Conversation

@sdercolin

Copy link
Copy Markdown
Owner

Reworks #49 (by @RibosomeK) on the current dev branch.

What it does

Adds an editor preference (off by default) that, in multiple entry edit mode, makes clicking an entry on the canvas set it as the current entry. Configurable under Preferences → Editor.

Fixes over the original PR

  • Wrong jump target for offset groups. The original passed the group-relative index straight to jumpToEntry, which targets the wrong module entry when the edited group doesn't start at index 0. This maps through entries[indexInGroup].index (the real module index).
  • "Doesn't jump unless the mouse moves" (the bug the original author flagged). The original read cursorState.position, which is only updated on mouse-move, so a press without a preceding move didn't jump. The click position is now derived from the press event itself.

The jump is gated on multiple entry edit mode (entries.size > 1); single edit mode is unaffected. getEntryIndexByCursorPosition already landed on dev (via #111), so it's reused rather than re-added.

Changes

  • AppConf.Editor: new clickToJumpToEntry field + DEFAULT_CLICK_TO_JUMP_TO_ENTRY = false.
  • PreferencesPages: a switch in the Editor page (with description).
  • Marker.kt: threads editorState + screenRange into the cursor press handler and performs the jump.
  • Strings for all four languages (en / zh-Hans / ja / ko); the original only covered en + zh, and I fixed the JumTo → JumpTo typo in the string key.

Tests

  • Direct tests for getEntryIndexByCursorPosition (contained / shared-border / outside).
  • The new preference switch is automatically covered by the existing PreferencesPagesTraversalTest (default value, serialization round-trip, field isolation).
  • ktlintCheck + the marker / preferences / strings suites pass.

The click-in-canvas pointer handler itself is UI/native code and isn't unit-tested, but it's a thin wrapper over the tested primitive.

🤖 Generated with Claude Code

Reworks PR #49 on the current dev branch.

Adds an editor preference (off by default) that, in multiple entry edit
mode, makes clicking an entry on the canvas set it as the current entry.

Two fixes over the original PR:
- The original passed the group-relative index straight to jumpToEntry,
  which targets the wrong module entry when the edited group does not
  start at index 0. Now maps through entries[indexInGroup].index.
- The original read cursorState.position (only updated on mouse move), so
  a press without a preceding move did not jump. Now the click position is
  derived from the press event itself.

The jump is gated on multiple entry edit mode (entries.size > 1); single
edit mode is unaffected.

Adds the preference field/default to AppConf, the preferences switch,
strings for all four languages (en/zh/ja/ko), and direct tests for
getEntryIndexByCursorPosition. The declarative switch is additionally
covered by the existing PreferencesPagesTraversalTest.

Co-Authored-By: RibosomeK <122797zhyktb@gmail.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sdercolin and others added 2 commits July 10, 2026 21:25
Jumping to the current entry is a no-op except that jumpToEntry always
fires the auto-centering scroll (scrollFitViewModel.emitNext), so
clicking the already-current entry re-centered the view unexpectedly.
Guard the jump on the target index differing from the current index.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Clicking the current entry's left border (shared with the previous
entry's end) switched the current entry to the previous one, because
getEntryIndexByCursorPosition resolves a shared border to the first
(left) entry. More generally, grabbing a border/point is a drag intent,
not an entry-selection intent.

Restrict the click-to-jump to presses that are not hovering a draggable
point (i.e. clicks on an entry body), and extract the logic into
maybeJumpToClickedEntry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sdercolin
sdercolin merged commit d21ebf3 into dev Jul 10, 2026
1 check passed
sdercolin added a commit that referenced this pull request Jul 13, 2026
Reflects the features merged in #111 and #112 across all four READMEs
(en/zh-CN/ja/ko):

- Correct the parameter-line key action note: it is no longer limited to
  single entry editing mode. In multi-entry editing mode Q/W move the
  left/right border of the entry under the cursor, and the current-entry
  border actions can be bound in Keymaps.
- Add the opt-in "Click to jump to entry" editor preference to the
  Multi-entry editing mode section.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant