Skip to content

Mode handlers couple to App state; introduce cursor-relative actions #81

Description

@garritfra

Problem

crates/cell-sheet-tui/src/mode/normal.rs reads app.cursor 30+ times to construct positional Action variants like:

Action::ClearCell(app.cursor)
Action::ChangeCell(app.cursor)

This couples mode handlers to App's internal shape and prevents reusing logic across modes. When find / search need to work in Visual or Command mode, every consumer has to either re-fetch app.cursor or re-emit the same positional action.

AGENTS.md's spirit is "mode handlers shouldn't know about app internals" — currently they do.

Proposed fix

Convert positional variants to cursor-relative:

Action::ClearCellAtCursor   // App resolves cursor at dispatch time
Action::ChangeCellAtCursor

process_action reads self.cursor at the dispatch site instead of trusting the mode to pass it. Mode handlers stop touching app.cursor for these cases.

This is a deferred / architectural cleanup — only worth doing once a second mode (Visual or Command) actually needs to share these actions.

Priority

MEDIUM (deferred) — track for when cross-mode action sharing comes up; do not do speculatively.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    designArchitectural / design worktech-debtTechnical debt — code health, refactor, test coveragevimVim modal editing

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions