Skip to content

Add key action support in multiple entry edit mode - #111

Merged
sdercolin merged 1 commit into
devfrom
feature/multi-edit-key-actions
Jul 10, 2026
Merged

sdercolin merged 1 commit into
devfrom
feature/multi-edit-key-actions

Conversation

@sdercolin

Copy link
Copy Markdown
Owner

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

What it does

In multiple entry edit mode:

  • SetValue1 / SetValue2 set the left / right border of the entry under the cursor to the cursor position.
  • New SetCurrentEntryLeft / SetCurrentEntryRight actions set the left / right border of the current entry, regardless of cursor position.

Single entry edit mode behavior is unchanged.

How it differs from the original PR

The original PR plumbed a MutableState<Int> for the current index (the author flagged that it couldn't read the newest value) and hand-rolled the flattened point-index math, which was incorrect for labelers where not all fields have shortcut indexes.

Since then, dev has refactored this area:

  • MarkerState now holds project, so the current index is read directly from project.currentModule.currentIndex — the original bug disappears, no extra state plumbing.
  • The flattened multi-entry point-index scheme is centralized, so this reuses the existing getDraggedEntries / border-index helpers instead of duplicating the math.

As a result the feature reduces to computing the correct flattened pointIndex in multi-edit mode, then reusing the existing drag machinery.

Notes

  • The two new actions have no default key binding (matching the original PR); users assign keys in preferences.
  • Added strings for all four languages (en / zh-Hans / ja / ko); the original only covered en + zh.

Tests

  • Extracted getStartBorderPointIndex / getEndBorderPointIndex (reused by the existing getPointIndexAsSingleEntry).
  • Added MarkerStateMiscTest cases for both borders, cursor-outside-any-entry, unsupported SetValue3+ in multi-edit, current-entry-vs-cursor divergence, and single-edit no-op for the new actions.
  • ktlintCheck + the marker / strings test suites pass.

🤖 Generated with Claude Code

Reworks PR #48 on the current dev branch.

In multiple entry edit mode:
- SetValue1 / SetValue2 now set the left / right border of the entry
  under the cursor to the cursor position.
- Adds SetCurrentEntryLeft / SetCurrentEntryRight actions that set the
  left / right border of the current entry regardless of cursor position.

The original PR plumbed a MutableState<Int> for the current index and
hand-rolled the flattened point-index math (which was buggy). The dev
branch already exposes `project` on MarkerState and centralizes the
flattened-index scheme, so this reads the current index from
`project.currentModule.currentIndex` and reuses the existing
getDraggedEntries / border-index helpers. Single edit mode behavior is
unchanged.

Adds English/Chinese/Japanese/Korean strings and tests covering the new
multi-edit resolution paths.

Co-Authored-By: RibosomeK <122797zhyktb@gmail.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sdercolin sdercolin self-assigned this Jul 10, 2026
@sdercolin
sdercolin merged commit baaaf94 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