Skip to content

Cmd+Shift+Z (Redo) doesn't work in TextView #46

@jamescrosswell

Description

@jamescrosswell

Problem

With the iTerm2 dynamic profile from #40 installed, Cmd+Z (Undo) works in TextView as expected, but Cmd+Shift+Z (Redo) does nothing.

What's wired up

iTerm2 binding (from the profile, comment on #41):

"0x7a-0x120000": { "Action": 11, "Text": "0x19" }

Decoded: z + (Cmd|Shift) → send byte 0x19 = Ctrl+Y.

Per Terminal.Gui's TextView docs, Ctrl+Y should invoke Redo. So either the bytes aren't reaching TG, or the binding isn't doing what the docs say.

Likely causes to investigate

  1. Chord shadowing. CLAUDE.md notes: "Chord wins over view bindings: Ctrl+W shadows TextView.Cut." Check whether anything in WorkbenchHost.BindDefaults or RegisterDefaultCommands has a binding starting with Ctrl+Y — even a single-key Ctrl+Y registration on the workbench scope would absorb the byte before TextView sees it.
  2. TextView Redo binding might not exist in TG 2.1.0 despite the docs. The docs page may be ahead of (or behind) the shipped binary. Confirm by inspecting TextView.KeyBindings at runtime or reading the TG 2.1.0 source. If it's not bound, we need a different sequence (or add the binding ourselves on our TextViews).
  3. iTerm2 swallowing Cmd+Shift+Z natively before our profile binding fires. Quick check: in iTerm2 settings, search Key Bindings (both Global and the TuiCode profile) for any entry on Cmd+Shift+Z that overrides ours. The profile binding should take precedence when the profile is active, but worth confirming.
  4. Undo stack not deep enough / cleared. Unlikely — Cmd+Z works, so the stack is live. But if Undo immediately pops the stack to empty, Redo would silently do nothing. Test: type, undo once, then try redo.

Repro

  1. Open a file in TuiCode under iTerm2 with the TuiCode dynamic profile active.
  2. Type some text. ✅ Appears.
  3. Press Cmd+Z. ✅ Last edit undone.
  4. Press Cmd+Shift+Z. ❌ Nothing happens (expected: last undo re-applied).

Diagnostic next steps

  • Use TG's input injection (per CLAUDE.md tests pattern) to inject a raw Ctrl+Y KeyEvent and see whether TextView redoes. If yes → the bytes aren't reaching TextView, look at workbench-scope bindings. If no → TextView doesn't have Redo on Ctrl+Y in this TG version.
  • Print TextView.KeyBindings at startup to confirm what's actually bound.

Out of scope

The iTerm2 profile itself looks correct — fixing this issue may require code changes in WorkbenchHost or a TextView subclass, not a profile edit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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