using System;
namespace MinecraftClient
{
///
/// Input buffer state passed with OnInputChange events.
///
public readonly struct ConsoleInputBuffer
{
public string Text { get; }
public int CursorPosition { get; }
public ConsoleInputBuffer(string text, int cursorPosition)
{
Text = text;
CursorPosition = cursorPosition;
}
}
///
/// Backend-independent suggestion item used by the TUI autocomplete popup.
/// Mirrors the shape of ConsoleInteractive.ConsoleSuggestion.Suggestion
/// without requiring a dependency on the ConsoleInteractive assembly.
///
public readonly struct CommandSuggestion
{
public string Text { get; }
public string Tooltip { get; }
public CommandSuggestion(string text, string tooltip = "")
{
Text = text;
Tooltip = tooltip;
}
}
///
/// Abstraction over the console I/O backend.
/// Implementations: ClassicConsoleBackend (ConsoleInteractive), TuiConsoleBackend (Avalonia/Consolonia), BasicConsoleBackend (stdio).
///
public interface IConsoleBackend
{
void Init();
void WriteLine(string text);
void WriteLineFormatted(string text);
void BeginReadThread();
void StopReadThread();
event EventHandler? MessageReceived;
event EventHandler? OnInputChange;
string RequestImmediateInput();
string? ReadPassword();
void ClearInputBuffer();
void ClearScreen();
bool DisplayUserInput { get; set; }
void SetInputVisible(bool visible);
void SetBackreadBufferLimit(int limit);
void Shutdown();
}
}