TL;DR

Terminal.Gui — thư viện TUI cross-platform cho .NET — vừa phát hành 2.0.0-rc.1 trên NuGet, đánh dấu cột mốc cuối trước bản stable v2.0. Bản RC này đóng gói hơn hai năm thiết kế lại: bỏ static singletons, thêm TrueColor 24-bit, scrolling inherent vào mọi View, Kitty Keyboard Protocol, Markdown view, Sixel image và AOT compatibility. Đây là bản nâng cấp lớn nhất kể từ khi Miguel de Icaza tạo ra thư viện này.

What's new

Thông báo đến từ Tig Kindel (@tigkindel), lead maintainer của tổ chức gui-cs:

"The first release candidate for Terminal.Gui v2.0 is now on nuget! Woot!"

Cài đặt ngay:

dotnet add package Terminal.Gui --version 2.0.0-rc.1

RC1 ra đời sau 218 bản beta. Riêng beta.218 — bản cuối trước RC — đã gom hơn 70 bug fixes, Kitty Keyboard Protocol (phases 1 & 2), Link view với OSC 8 hyperlink, và MarkdownView render CommonMark/GFM thẳng trong terminal.

Why it matters

Terminal.Gui là thư viện TUI phổ biến nhất cho .NET với 10.9k stars GitHub và cộng đồng gui-cs hoạt động bền bỉ. Một codebase, chạy cả Windows, macOS, Linux/Unix — đây là nền tảng mà nhiều dev tool, ops dashboard và installer CLI bên hệ sinh thái .NET dùng từ nhiều năm nay.

Phiên bản v1 đã đóng băng ở chế độ maintenance: chỉ nhận bug fix, không có feature mới. Ai đang viết hoặc bảo trì app console bằng .NET sẽ phải nhìn sang v2 sớm hay muộn. RC1 nghĩa là API đã stable đủ để production thử nghiệm — chỉ còn chờ feedback cộng đồng trước khi stamp bản GA.

Điểm đáng chú ý: cú chuyển này không phải "refactor nhỏ". Từ app model, event system, keyboard/mouse, layout, cho tới dependency string đều bị làm lại. Đổi lại là một codebase nhất quán hơn, testable hơn, và mở đường cho các feature vốn không thể có trong terminal: TrueColor, Sixel, hyperlink, AOT.

Technical facts

  • Kiến trúc instance-based: thay static Application singleton bằng IApplication, cho phép nhiều application context trong cùng process — test tốt hơn, không còn global state.
  • TrueColor 24-bit mặc định với auto-fallback 16-color cho terminal cũ; class Attribute xử lý RGB.
  • Scrolling built-in trên mọi View qua Viewport, GetContentSize(), SetContentSize()ScrollViewScrollBarView bị khai tử.
  • Adornment system: Margin, Border, Padding với line style Single/Double/Heavy/Rounded/Dashed/Dotted; LineCanvas tự xử lý giao điểm và glyph T-junction.
  • Keyboard hiện đại: class Key thay KeyEvent, Command enum bindings với scope Application/Focused/HotKey, hỗ trợ Kitty Keyboard Protocol.
  • Mouse với MouseEventArgs, double-click, movement tracking, toạ độ viewport-relative.
  • Views mới: CharMap, ColorPicker, DatePicker, DateEditor, TimeEditor, GraphView, NumericUpDown, LinearRange, SpinnerView, Link (OSC 8), MarkdownView.
  • Layout: Dim.Auto() auto-size theo content, Pos.Align Left/Center/Right, View.Arrangement với Movable/Resizable/Overlapped để drag-drop và quản lý Z-order.
  • ConfigurationManager lưu theme, key binding, view props ra JSON ở scope user/app/machine.
  • Sixel image, AOT compatibility, tích hợp Microsoft.Extensions.Logging, IDisposable đầy đủ.

Comparison v1 vs v2

Aspectv1v2
Application modelStatic singletonIApplication instance
Button eventButton.ClickedButton.Accepting
String typeNStack.ustringSystem.Rune
EventsMix Action / Action<EventArgs>Chuẩn EventHandler<EventArgs>
ScrollingScrollView wrapperInherent trên View
Color16 color24-bit TrueColor
TimeoutsApplication.MainLoop.AddTimeoutTrực tiếp trên Application
ConstructorPositional paramsObject initializer

Use cases

  • Dev tools: CLI installer, wizard, interactive config — nay có checkbox, radio, date picker, markdown doc preview ngay trong terminal.
  • Ops dashboards: graph view với TrueColor cho CPU/mem/latency; Sixel image để render thumbnail hoặc logo.
  • Data inspectors: TableView cải tiến, sort/filter, in-place edit — thay cho viết lại từ đầu bằng ncurses.
  • AOT single-file TUI: deploy container/server không cần .NET runtime.
  • Migrate từ v1: đội đang mang legacy console app sang có đường migration chính thức, với migration guide liệt kê đầy đủ breaking changes và pattern thay thế.
  • Interactive TUI sandbox: View.Arrangement với Movable, Resizable, Overlapped cho phép build app dạng "window manager" ngay trong terminal — drag cửa sổ, resize bằng chuột, Z-order đầy đủ.
  • Localization: chuyển sang System.Rune giúp handle wide-character và Unicode quốc tế chuẩn hơn; MarkdownView có thể render doc tiếng Việt, tiếng Trung, emoji trực tiếp.

Install tip

RC là prerelease, khi thêm package qua CLI cần cờ prerelease:

dotnet add package Terminal.Gui --version 2.0.0-rc.1
# hoặc
dotnet add package Terminal.Gui --prerelease

Nếu đang dùng v1 trong project hiện tại, cân nhắc tạo branch migrate riêng — breaking changes đủ nhiều để không nên làm thẳng trên main.

Limitations & pricing

Miễn phí, MIT license. Vẫn là RC nên API có thể đổi nhỏ trước GA. v1 chỉ nhận bug fix — feature mới đều về v2. Yêu cầu .NET runtime phiên bản hiện đại; xác nhận chi tiết theo NuGet metadata.

What's next

Sau chuỗi beta.1beta.218, team dự kiến gom feedback RC1 và stamp bản 2.0.0 stable. Dự án dẫn dắt bởi @tig với @BDisp, @YourRobotOverlord, @akrantz và cộng đồng gui-cs; Miguel de Icaza — tác giả gốc — được tag trong announcement gốc.

Nguồn: Terminal.Gui docs, What's new in v2, GitHub Releases, Migration guide.