feat: Enhance menu rendering and input handling

- Added support for new plugins: IrondashEngineContext and SuperNativeExtensions in the Flutter plugin registrant.
- Updated CMake configuration to include new plugins.
- Introduced a new dependency, super_clipboard, in pubspec.yaml.
- Enhanced the WolfEngine to set the menu background color.
- Implemented keyboard shortcuts for renderer mode toggling and ASCII theme cycling in CLI input handling.
- Updated menu manager to include a universal menu background color.
- Refactored ASCII and Sixel renderers to utilize the new menu background color and improved header drawing logic.
- Simplified the drawing of menu options sidebars and header bars across different renderers.
- Improved the layout and centering of menu titles in the header bar.

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-20 14:46:08 +01:00
parent 297f6f0260
commit 4d5b30f007
15 changed files with 740 additions and 324 deletions

View File

@@ -115,9 +115,8 @@ class CliGameLoop {
return;
}
if (bytes.contains(9)) {
// Tab swaps between renderers so renderer debugging stays available
// without restarting the process.
if (input.matchesRendererToggleShortcut(bytes)) {
// Allow dynamic renderer-switch bindings configured on the CLI input.
_renderer = identical(_renderer, secondaryRenderer)
? primaryRenderer
: secondaryRenderer;
@@ -125,7 +124,7 @@ class CliGameLoop {
return;
}
if (bytes.contains(116) || bytes.contains(84)) {
if (input.matchesAsciiThemeCycleShortcut(bytes)) {
_cycleAsciiTheme();
return;
}
@@ -188,5 +187,37 @@ class CliGameLoop {
engine.tick(elapsed);
stdout.write(_renderer.render(engine));
_writeShortcutHintLine();
}
void _writeShortcutHintLine() {
if (!stdout.hasTerminal) {
return;
}
final int cols = stdout.terminalColumns;
if (cols <= 0) {
return;
}
final String hint = _buildShortcutHintText();
final String visible = hint.length > cols ? hint.substring(0, cols) : hint;
final String padded = visible.padRight(cols);
// Draw an overlay line without disturbing the renderer's cursor position.
stdout.write('\x1b[s\x1b[1;1H\x1b[0m\x1b[2m$padded\x1b[0m\x1b[u');
}
String _buildShortcutHintText() {
final String rendererMode = _renderer is SixelRenderer ? 'sixel' : 'ascii';
final String rendererHint =
'<${input.rendererToggleKeyLabel}> $rendererMode';
if (_renderer is AsciiRenderer) {
final AsciiRenderer ascii = _renderer as AsciiRenderer;
return '$rendererHint <${input.asciiThemeCycleKeyLabel}> ${ascii.activeTheme.name}';
}
return rendererHint;
}
}