Skip to content

Conversation

@peterven
Copy link

@peterven peterven commented Jan 3, 2026

This PR adds support for running nocterm applications on Windows:

Changes

stdio_backend.dart

  • Add Windows-specific resize detection using polling (250ms interval) since SIGWINCH is not available on Windows
  • Initialize resize and shutdown stream controllers for all platforms
  • Add SIGINT handling for Ctrl+C on Windows
  • Add _windowsResizeTimer and _lastKnownSize fields for polling

app.dart

  • Add cross-platform keyboard input parsing via _parseKeyInput()
  • Support Windows extended key codes (0xE0 prefix for arrow keys)
  • Support Windows carriage return (0x0D) for Enter key
  • Support Windows backspace (0x08)
  • Support both Unix ANSI sequences and Windows Terminal ANSI variants

Testing

Tested on Windows 11 with Windows Terminal - the app renders correctly and keyboard input is properly handled.

🤖 Generated with Claude Code

peterven and others added 3 commits January 10, 2026 17:56
This PR adds support for running nocterm applications on Windows:

## Changes

### stdio_backend.dart
- Add Windows-specific resize detection using polling (250ms interval)
  since SIGWINCH is not available on Windows
- Initialize resize and shutdown stream controllers for all platforms
- Add SIGINT handling for Ctrl+C on Windows
- Add _windowsResizeTimer and _lastKnownSize fields for polling

### app.dart
- Add cross-platform keyboard input parsing via _parseKeyInput()
- Support Windows extended key codes (0xE0 prefix for arrow keys)
- Support Windows carriage return (0x0D) for Enter key
- Support Windows backspace (0x08)
- Support both Unix ANSI sequences and Windows Terminal ANSI variants

## Testing
Tested on Windows 11 with Windows Terminal - the app renders correctly
and keyboard input is properly handled.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Windows doesn't send arrow keys and other special keys through stdin -
they require the Windows Console API (ReadConsoleInput).

This commit adds:
- win32_ansi_stdin.dart: FFI wrapper for Windows Console API that:
  - Uses ReadConsoleInput to capture keyboard events
  - Translates Windows virtual key codes to ANSI escape sequences
  - Supports arrow keys, function keys, navigation keys
  - Handles modifier keys (Ctrl, Alt, Shift)
  - Provides mouse input translation to SGR format
- Updates stdio_backend.dart to use Win32AnsiStdin on Windows
- Adds ffi dependency for native memory allocation

This enables TUI applications like vide to receive proper keyboard
input on Windows, including arrow keys for cursor movement.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants