Skip to content
المشاريع

حول

A modern .NET replacement for System.Console

أدوات التطوير

كيف تُقاس هذه الأرقام

ما يمكنك فعله

  • Console-compatible API surface: Title, cursor, window, ReadKey/ReadLine-style workflows
  • Serialized writers prevent interleaved escape sequences across threads
  • Atomic writes for multi-step output without tearing
  • Markup + ANSI styling (powered by XenoAtom.Ansi)

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
٠
خلال 15 يومًا
+٢
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

XenoAtom.Terminal ci NuGet

XenoAtom.Terminal is a modern replacement for System.Console designed for TUI/CLI apps: serialized output, rich ANSI/markup rendering, unified input events, and deterministic tests.

🚀 Quick start

using XenoAtom.Terminal;

Terminal.WriteLine("Hello");
Terminal.WriteMarkup("[bold green]Hello[/] [gray]world[/]!");

✨ Features

  • Console-compatible API surface: Title, cursor, window, ReadKey/ReadLine-style workflows
  • Output (ANSI-safe):
    • Serialized writers prevent interleaved escape sequences across threads
    • Atomic writes for multi-step output without tearing
    • Markup + ANSI styling (powered by XenoAtom.Ansi)
    • Custom markup tokens via Terminal.MarkupStyles / Terminal.SetMarkupStyle
    • Graphics capability detection via Terminal.Graphics and optional image output through XenoAtom.Terminal.Graphics (Kitty, iTerm2, Sixel), including direct-output fallback text, optional cell reservation, encoded image caching, Sixel RGB332 fast palette mode, and real-time frame source notifications
  • Input (unified events):
    • Single event stream for keys, text, mouse, resize, signals
    • Extended key modifiers through native Windows console input or probed Kitty keyboard protocol (Terminal.Capabilities.SupportsExtendedKeys / ExtendedKeyProtocol)
    • Async + cancellation-friendly APIs for TUI loops
  • Interactive ReadLine editor:
    • Cursor movement, mid-line insert/delete, word navigation/delete
    • Grapheme cluster-aware editing (emoji/ZWJ/combining sequences)
    • Undo/redo + reverse incremental history search
    • Selection by keyboard (Shift) and mouse click/drag
    • History stored on the TerminalReadLineOptions instance (shareable, not global)
    • Completion + extensibility via custom key/mouse handlers (TerminalReadLineController)
    • Clipboard-friendly shortcuts (Ctrl+C/Ctrl+X/Ctrl+V) when available
    • Readable control-char helpers via TerminalChar (e.g. TerminalChar.CtrlC)
    • Gesture formatting/parsing via TerminalKeyGesture (e.g. CTRL+R)
    • Styled prompt (PromptMarkup) + custom line rendering (MarkupRenderer)
  • Scopes + state management:
    • Reliable scopes: alternate screen, raw/cbreak mode, bracketed paste, mouse reporting, hide cursor
    • State tracking: style/colors/decorations, title, cursor position/visibility, window size
  • Clipboard: cross-platform text plus named clipboard formats (for example PNG images), including OSC 52 text fallback for remote shells
  • CI + testing:
    • CI-aware backend keeps colors when output is redirected
    • In-memory backend for deterministic tests (capture output, inject events or feed raw VT input)
    • Standalone TerminalInstance instances and thread-local Terminal.UseInstance(...) scopes isolate parallel tests without replacing the global terminal; an opt-in allowOutOfOrderDisposal lets a component end its own scope while nested scopes are active
  • Cross-platform + AOT: Windows Console + Unix (Linux/macOS), net10.0+ and NativeAOT-friendly design
  • Unix terminfo detection: uses terminfo + environment hints for colors (16/256/truecolor) and related capabilities (alternate screen/cursor visibility)

Screenshot of the interactive sample HelloReadLine demo:

Interactive ReadLine Demo

[!NOTE] XenoAtom.Terminal is a terminal API, not a widget/UI framework. It provides safe I/O, terminal state/scopes, and input events; higher-level libraries can build screen buffers, widgets, and layouts on top.

📖 User Guide

For more details on how to use XenoAtom.Terminal, please visit the user guide.

🧪 Sample

  • samples/HelloImage displays a small markup header and a sample image with terminal graphics.
  • samples/HelloTerminal prints all input events (key/mouse/resize/text/signal) and demonstrates scopes.
  • samples/HelloReadLine demonstrates the interactive ReadLine editor (history, selection, completion, and markup rendering).
  • samples/LogTerminal prints colored pseudo log lines (timestamp/level/category/message) and is run in CI to validate ANSI output.

🪪 License

This software is released under the BSD-2-Clause license.

🤗 Author

Alexandre Mutel aka xoofx.

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…