Skip to content

CliHost.RunWithTerminalGuiAsync ignores CommandKind - input clets run full-screen instead of inline #15

Description

@tig

Bug

CliHost.RunWithTerminalGuiAsync always creates a full-screen IApplication regardless of command.Kind. Input clets (CommandKind.Input) are specified to render inline by default (see clet spec §4.5: "Input clets render inline. Viewer clets render fullscreen. --fullscreen forces fullscreen for input clets").

After the port to Terminal.Gui.Cli, running e.g. clet select --options "foo, bar" goes full-screen instead of rendering inline beneath the cursor.

Root cause

CliHost.cs line ~170:

private async Task<CommandResult> RunWithTerminalGuiAsync (ICliCommand command, CommandRunOptions runOptions,
    CancellationToken cancellationToken)
{
    using IApplication app = Application.Create ().Init ();
    return await command.RunAsync (app, runOptions.Initial, runOptions, cancellationToken);
}

This never checks command.Kind or runOptions.Fullscreen. It should set Application.AppModel before calling Application.Create() based on:

  1. command.Kind == CommandKind.ViewerAppModel.FullScreen
  2. command.Kind == CommandKind.Input and runOptions.Fullscreen == trueAppModel.FullScreen
  3. command.Kind == CommandKind.Input and runOptions.Fullscreen == falseAppModel.Inline

Expected fix

Something like:

private async Task<CommandResult> RunWithTerminalGuiAsync (ICliCommand command, CommandRunOptions runOptions,
    CancellationToken cancellationToken)
{
    bool useInline = command.Kind == CommandKind.Input && !runOptions.Fullscreen;
    Application.AppModel = useInline ? AppModel.Inline : AppModel.FullScreen;

    using IApplication app = Application.Create ().Init ();
    return await command.RunAsync (app, runOptions.Initial, runOptions, cancellationToken);
}

Impact

All 14 input clets in gui-cs/clet regressed to full-screen rendering after the Terminal.Gui.Cli port. This is a v0.5 blocking issue per the spec milestones ("inline rendering verified on four-terminal matrix").

Repro

clet select --options "foo, bar"
# Expected: inline prompt below cursor (like fzf --height or gum choose)
# Actual: full-screen TUI

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions