Skip to content

Define IPlatformConsole interface and console event types #78

@Aaronontheweb

Description

@Aaronontheweb

Parent: #77

Summary

Create the core platform abstraction interface and event types that will be implemented by platform-specific console handlers.

Files to Create

  • src/Termina/Platform/IPlatformConsole.cs
  • src/Termina/Platform/ConsoleInputEvent.cs
  • src/Termina/Platform/PlatformConsoleFactory.cs

Interface Design

public interface IPlatformConsole : IDisposable
{
    void Initialize();
    void Restore();
    Task<ConsoleInputEvent?> ReadInputAsync(CancellationToken ct);
    (int Width, int Height) GetSize();
    IObservable<(int Width, int Height)> Resized { get; }
    void Write(string text);
    void Flush();
}

Event Types

public abstract record ConsoleInputEvent;
public record KeyEvent(ConsoleKeyInfo KeyInfo) : ConsoleInputEvent;
public record MouseEvent(...) : ConsoleInputEvent;  // If needed
public record ResizeEvent(int Width, int Height) : ConsoleInputEvent;

Acceptance Criteria

  • Interface defined with XML documentation
  • Event types defined as records
  • Factory stub with platform detection logic
  • No implementation yet (just interface and types)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions