You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Move EnableVirtualTerminalIO from InitAsync to EnterAlternateScreen so
Console.ReadKey works correctly in normal (non-alternate) mode
- Make EnableVirtualTerminalIO idempotent with a guard flag
- Use ReadKey(intercept: true) in normal mode — callers control echo
- Add TerminalViewportExtensions.WriteInPlace for in-place line updates
- MenuBase: show "> " prompt and echo selection in normal mode
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,3 +17,9 @@ The version is defined in two places — both must be updated together:
17
17
The CI workflow composes the full package version from `VERSION_PREFIX`, `VERSION_REV`, and `VERSION_HASH`.
18
18
19
19
When bumping the version, update both files to keep them in sync.
20
+
21
+
## Key design notes
22
+
23
+
-**Windows VT I/O** (`WindowsConsoleInput.EnableVirtualTerminalIO`) is only activated when entering alternate screen mode, not during `InitAsync()`. This keeps `Console.ReadKey` working correctly in normal (non-alternate) mode for ASCII/text-based UIs.
24
+
-**`TryReadInput`** uses `intercept: true` in normal mode — keystrokes are never echoed. Callers control display feedback (e.g., via `WriteInPlace`).
25
+
-**`MenuBase<T>`** in normal mode shows a `> ` prompt and echoes the selected item on confirmation.
Copy file name to clipboardExpand all lines: src/Console.Lib/README.md
+13-2Lines changed: 13 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -118,6 +118,16 @@ public interface ITerminalViewport
118
118
119
119
`TermCell` holds the pixel dimensions of a single terminal character cell, queried from the terminal during initialization via the `\e[16t` control sequence.
120
120
121
+
### TerminalViewportExtensions
122
+
123
+
Extension methods for `ITerminalViewport`:
124
+
125
+
```csharp
126
+
// Overwrite the current line in-place using \r, padding with spaces to erase stale content.
127
+
// Does not advance to the next line — ideal for status prompts and progress indicators.
128
+
terminal.WriteInPlace("> waiting...");
129
+
```
130
+
121
131
### IVirtualTerminal
122
132
123
133
Extends `ITerminalViewport` with full terminal lifecycle: initialization, input reading, alternate screen buffer, and Sixel capability detection.
@@ -141,9 +151,10 @@ public interface IVirtualTerminal : ITerminalViewport, IAsyncDisposable
141
151
1. Sets UTF-8 encoding for stdin/stdout
142
152
2. Sends a Device Attributes request (`\e[0c`) to detect terminal capabilities (including Sixel support)
143
153
3. Sends a cell size query (`\e[16t`) to determine pixel dimensions per character cell
144
-
4. On Windows, enables virtual terminal I/O and mouse input via `WindowsConsoleInput`
145
154
146
-
When entering the alternate screen, it enables VT200 mouse tracking with SGR extended coordinates (`\e[?1000h`, `\e[?1006h`), parses SGR mouse events from raw stdin, and normalizes cell coordinates to pixel coordinates using the cell size.
155
+
When entering the alternate screen, it enables virtual terminal I/O and mouse input via `WindowsConsoleInput` (Windows only), then enables VT200 mouse tracking with SGR extended coordinates (`\e[?1000h`, `\e[?1006h`), parses SGR mouse events from raw stdin, and normalizes cell coordinates to pixel coordinates using the cell size.
156
+
157
+
In normal (non-alternate) screen mode, `TryReadInput()` uses `Console.ReadKey(intercept: true)` — keystrokes are not echoed, giving the caller full control over display feedback.
0 commit comments