Skip to content

Editor: overwrite / insert-replace mode (Insert key) #146

@tig

Description

@tig

Summary

Terminal.Gui.TextView supports overwrite mode: Used state + Command.ToggleOverwrite (Insert key), Command.EnableOverwrite, Command.DisableOverwrite, a distinct caret rendering, and typing that replaces the rune under the caret instead of inserting. Editor is insert-only — no overwrite state, command, or caret style.

Editor is intended to functionally replace TextView (not API/UI-compatible); overwrite is a widely-expected editor mode and a genuine gap. Not replicable by a consumer: requires intercepting text input before the document edit plus a mode-aware caret.

Scope

  • OverwriteMode state on Editor (the field-keyword pattern; default off).
  • Wire Command.ToggleOverwrite / Command.EnableOverwrite / Command.DisableOverwrite (these Command enum members already exist in TG) via AddCommand and the configurable [ConfigurationProperty] Editor.DefaultKeyBindings (Insert = default toggle). No inline if in OnKeyDownNotHandled.
  • Text-insertion path in Editor.Keyboard.cs: when overwrite is on and the caret is not at line-end and there is no selection, replace the rune at the caret (grapheme-aware, one undo step) instead of inserting.
  • Caret rendering: block/underline variant while overwrite is active (coordinate with Editor.UpdateCursor should not override the default cursor style #143/Preserve Editor cursor style when updating position #144 cursor-style work).
  • examples/ted: status-bar indicator (R9).

Definition of done

  • OverwriteMode + three commands bound through Editor.DefaultKeyBindings; user-overridable.
  • Typing in overwrite replaces the caret grapheme (wide-rune safe); selection + line-end still insert; one undo step.
  • Distinct caret while active.
  • ted status-bar indicator (R9).
  • specs/overwrite-mode/spec.md; specs/public-api.md updated (R8).
  • Failing-first tests; suites green; dotnet format + jb clean.

Refs: specs/textview-parity-gap/spec.md Gap 2.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions