Skip to content

Normal mode: r{char} to replace the cell with a single character #39

Description

@garritfra

Vim's r{char} overwrites a single character without entering insert mode. The cleanest sheet equivalent overwrites the entire cell, since cells are atomic.

Design questions

  1. Replace whole cell vs first character? Whole cell is more useful (acts like a fast "type one digit") and matches the spreadsheet "cells are atomic" model. Recommend whole cell.
  2. Numbers. r5 should produce a numeric 5, going through the same auto-detect as plain edits.
  3. Visual range. r5 over a visual selection should fill every selected cell with 5 (vim semantics).

Scope (assuming whole-cell replacement)

  • NormalState pending = Some('r') consumes one char.
  • Dispatches Action::EditCell(pos, char.to_string()).
  • In visual modes: dispatches a new Action::FillRange { start, end, raw } that goes through the standard edit pipeline so the dep graph stays consistent (one undo entry, one recalc).

Tests

  • Cell "hello", press r5 → cell holds numeric 5.
  • Visual range, r0 → every cell becomes 0, all in one undo entry.
  • Esc after r aborts cleanly.

Out of scope

R (replace mode) — that's an Insert-mode variant; deserves its own issue if anyone wants it.

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 workenhancementNew feature or requestvimVim modal editing

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions