Skip to content

Commit 21ea569

Browse files
committed
Overhaul README for discoverability and accuracy
- Remove "early days" warning (library has 53 releases, 6K downloads, 3 real apps) - Fix incorrect tcsetattr claims (only ReadKey/KeyAvailable, not SetCursorPosition etc.) - Replace wall-of-text intro with scannable bullet points - Add NuGet download count badge, fix build badge workflow path - Remove stale version badge and hardcoded version in PackageReference - Expand controls list from 7 to full 30+ table by category - Complete documentation links (add 5 missing: Examples, Compositor, Portal, DOM, Rendering) - Add LazyDotIDE to Projects Using section - Move Development Notes to bottom - Remove duplicate debug logging section - Update Acknowledgments to credit Terminal.Gui v2 - Update project structure with all 20 examples
1 parent 128750e commit 21ea569

1 file changed

Lines changed: 47 additions & 108 deletions

File tree

README.md

Lines changed: 47 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,21 @@
77
<p align="center">
88
<a href="https://nickprotop.github.io/ConsoleEx/"><img src="https://img.shields.io/badge/docs-latest-blue" alt="Documentation"></a>
99
<a href="https://www.nuget.org/packages/SharpConsoleUI/"><img src="https://img.shields.io/nuget/v/SharpConsoleUI.svg" alt="NuGet"></a>
10-
<img src="https://github.com/nickprotop/ConsoleEx/workflows/Build/badge.svg" alt="Build">
11-
<img src="https://img.shields.io/badge/version-2.0-blue" alt="Version">
10+
<a href="https://www.nuget.org/packages/SharpConsoleUI/"><img src="https://img.shields.io/nuget/dt/SharpConsoleUI.svg" alt="NuGet Downloads"></a>
11+
<img src="https://github.com/nickprotop/ConsoleEx/actions/workflows/build-and-publish.yml/badge.svg" alt="Build">
1212
<img src="https://img.shields.io/badge/.NET-9.0-purple" alt=".NET">
1313
<img src="https://img.shields.io/badge/license-MIT-green" alt="License">
1414
</p>
1515

16-
**SharpConsoleUI** is a modern .NET 9 TUI framework that combines Spectre.Console's rich markup with true multi-window capabilities. **Cross-platform from the ground up.** Each window can run on its own dedicated thread, updating independently without blocking others. **Build beautiful UIs with familiar [markup] syntax everywhere.** No complex styling APIs, just `[bold red]text[/]` and it works. The double-buffered console driver built on .NET's native Console API eliminates flicker and ensures smooth rendering. **Any Spectre.Console widget (Tables, BarCharts, Trees, Panels) works as a window control.** Wrap any `IRenderable` and it just works. Direct CharacterBuffer access with PreBufferPaint/PostBufferPaint hooks lets you build custom rendering, visual effects, or even games (the Snake example renders its canvas this way). Fluent builders for windows, controls, and layouts.
16+
**SharpConsoleUI** is a multi-window TUI framework for .NET 9 that combines Spectre.Console's rich markup with true overlapping window capabilities. Cross-platform (Windows, Linux, macOS).
1717

18-
> **Note:** This project is still in early days — work in progress and not production-stable yet. Feedback and contributions welcome.
18+
- **Multi-window with per-window threads** — each window updates independently without blocking others
19+
- **Spectre.Console markup everywhere** — just `[bold red]text[/]` and it works, no complex styling APIs
20+
- **Any Spectre.Console widget works as a control** — Tables, BarCharts, Trees, Panels — wrap any `IRenderable`
21+
- **Double-buffered, flicker-free rendering** with dirty region tracking
22+
- **30+ built-in controls** — buttons, lists, trees, tables, text editors, dropdowns, menus, tabs, and more
23+
- **Compositor effects** — PreBufferPaint/PostBufferPaint hooks for custom rendering, transitions, or even games
24+
- **Fluent builders** for windows, controls, and layouts
1925

2026
**Visit the project website: [nickprotop.github.io/ConsoleEx](https://nickprotop.github.io/ConsoleEx/)**
2127

@@ -27,10 +33,6 @@
2733

2834
*SharpConsoleUI in action - rich controls, multiple windows, smooth gradients, real-time updates, and full-screen capabilities*
2935

30-
## Development Notes
31-
32-
SharpConsoleUI was initially developed manually with core windowing functionality and double-buffered rendering. The project evolved to include modern features (DOM-based layout system, fluent builders, plugin architecture, theme system) with AI assistance. Architectural decisions and feature design came from the project author, while AI generated code implementations based on those decisions. The development process involved code generation, review sessions, debugging, and manual refinements. This collaborative approach enabled rapid iteration on complex features while maintaining architectural coherence.
33-
3436
## Quick Start
3537

3638
```csharp
@@ -57,36 +59,12 @@ windowSystem.AddWindow(window);
5759
windowSystem.Run();
5860
```
5961

60-
## Table of Contents
61-
62-
- [Development Notes](#development-notes)
63-
- [Installation](#installation)
64-
- [Core Features](#core-features)
65-
- [API Usage](#api-usage)
66-
- [Architecture Overview](#architecture-overview)
67-
- [Examples](#examples)
68-
- [Advanced Features](#advanced-features)
69-
- [Contributing](#contributing)
70-
- [Documentation](#documentation)
71-
- [Projects Using SharpConsoleUI](#projects-using-sharpconsoleui)
72-
7362
## Installation
7463

75-
### Package Manager
76-
```bash
77-
Install-Package SharpConsoleUI
78-
```
79-
80-
### .NET CLI
8164
```bash
8265
dotnet add package SharpConsoleUI
8366
```
8467

85-
### PackageReference
86-
```xml
87-
<PackageReference Include="SharpConsoleUI" Version="2.0.0" />
88-
```
89-
9068
## Core Features
9169

9270
### Window Management
@@ -113,14 +91,16 @@ dotnet add package SharpConsoleUI
11391
- **Plugins**: Extensible architecture with DeveloperTools plugin
11492
- **Status Bars**: Top and bottom status bar support
11593

116-
### Controls Library
117-
- **MarkupControl**: Rich text with Spectre.Console markup
118-
- **ButtonControl**: Interactive buttons with events
119-
- **CheckboxControl**: Toggle controls
120-
- **MultilineEditControl**: Text editing with scrolling
121-
- **TreeControl**: Hierarchical data display
122-
- **ListControl**: List display and selection
123-
- **HorizontalGridControl**: Tabular data display
94+
### Controls Library (30+)
95+
96+
| Category | Controls |
97+
|----------|----------|
98+
| **Text & Display** | MarkupControl, FigleControl, RuleControl, SeparatorControl, SparklineControl, BarGraphControl, LogViewerControl |
99+
| **Input** | ButtonControl, CheckboxControl, PromptControl, DropdownControl, MultilineEditControl |
100+
| **Data** | ListControl, TreeControl, TableControl, HorizontalGridControl |
101+
| **Navigation** | MenuControl, ToolbarControl, TabControl |
102+
| **Layout** | ColumnContainer, SplitterControl, ScrollablePanelControl, PanelControl |
103+
| **Advanced** | SpectreRenderableControl (wraps any Spectre.Console `IRenderable`), ProgressBarControl, TerminalControl |
124104

125105
## API Usage
126106

@@ -650,7 +630,7 @@ See the [Compositor Effects Guide](https://nickprotop.github.io/ConsoleEx/docfx/
650630

651631
**Status**: Fixed. On Unix, SharpConsoleUI bypasses .NET's Console infrastructure entirely using raw libc I/O for both input (`read` from stdin fd 0) and output (`write` to stdout fd 1). The terminal is put into raw mode via `tcgetattr`/`tcsetattr`, and `Console.Out` is redirected to `/dev/null` to prevent any .NET runtime code from touching terminal settings. This eliminates the echo leak at its root.
652632

653-
**Root cause**: .NET's `ConsolePal.Unix` calls `tcsetattr` on virtually every `Console.*` access — not just `ReadKey`, but also `SetCursorPosition`, `CursorVisible`, `WindowWidth`, and even `OutputEncoding`. Each call briefly toggles the ECHO flag, creating windows where raw ANSI sequences leak to the screen.
633+
**Root cause**: .NET's `ConsolePal.Unix` calls `tcsetattr` when `Console.ReadKey`/`KeyAvailable` is used, briefly toggling the ECHO terminal flag. During these brief windows, raw ANSI input sequences (especially mouse reports) leak to the screen as visible garbage characters.
654634

655635
**Solution approach inspired by [Terminal.Gui v2](https://github.com/gui-cs/Terminal.Gui)**, which solved the same problem by avoiding all .NET Console APIs on Unix. The fix can be disabled via `ConsoleWindowSystemOptions(UseDirectAnsi: false)` to fall back to .NET Console APIs if needed.
656636

@@ -700,15 +680,17 @@ ConsoleEx/
700680
│ ├── Helpers/ # Utility classes
701681
│ ├── Drivers/ # Console abstraction layer
702682
│ └── Themes/ # Theming system
703-
├── Examples/ # Example applications
683+
├── Examples/ # 20 example applications
704684
│ ├── DemoApp/ # Comprehensive demo
705685
│ ├── ConsoleTopExample/ # System monitoring dashboard
706686
│ ├── FullScreenExample/ # Full screen demo
707687
│ ├── PluginShowcaseExample/# Plugin system demo
708-
│ ├── AgentStudio/ # Advanced agent demo
709-
│ ├── MultiDashboard/ # Multi-window dashboard
710-
│ ├── MenuDemo/ # Menu system demo
711-
│ └── BorderStyleDemo/ # Border style demo
688+
│ ├── SnakeGame/ # Snake game (compositor effects)
689+
│ ├── TextEditorExample/ # Multi-line text editor
690+
│ ├── TabControlDemo/ # Tab control showcase
691+
│ ├── TableDemo/ # Table control showcase
692+
│ ├── CompositorEffectsExample/ # Visual effects demo
693+
│ └── ... # And more (see Examples/)
712694
└── Tests/ # Unit tests
713695
```
714696

@@ -719,83 +701,35 @@ ConsoleEx/
719701
- Add unit tests for new features
720702
- Maintain backward compatibility
721703

722-
### Critical: Console Output & Logging
723-
**NEVER use console-based output in SharpConsoleUI applications - it corrupts the display!**
724-
725-
**❌ Avoid These (corrupt UI rendering):**
726-
- `Console.WriteLine()`, `Console.Write()`, `Console.Clear()`
727-
- `builder.AddConsole()` in logging configuration
728-
- Any output that writes directly to console
729-
730-
**✅ Use These Alternatives:**
731-
- **UI Updates**: `window.AddControl(new MarkupControl("message"))`
732-
- **File Logging**: File-based or database logging providers
733-
- **Debug Logging**: Only in development, not console output
734-
- **Event Logging**: Windows Event Log or similar
735-
736-
**Use the built-in logging instead:**
737-
```bash
738-
# Enable debug logging via environment variables
739-
export SHARPCONSOLEUI_DEBUG_LOG=/tmp/consoleui.log
740-
export SHARPCONSOLEUI_DEBUG_LEVEL=Debug
741-
```
742-
743-
### Built-in Debug Logging
744-
745-
The library includes a built-in debug logging system for troubleshooting, controlled via environment variables:
746-
747-
```bash
748-
# Enable debug logging to file
749-
export SHARPCONSOLEUI_DEBUG_LOG=/tmp/consoleui.log
750-
751-
# Set minimum log level (Trace, Debug, Information, Warning, Error, Critical)
752-
export SHARPCONSOLEUI_DEBUG_LEVEL=Debug
753-
```
754-
755-
Access logs programmatically:
756-
```csharp
757-
// Subscribe to log events
758-
windowSystem.LogService.LogAdded += (s, entry) => { /* handle entry */ };
759-
760-
// Get recent logs
761-
var logs = windowSystem.LogService.GetRecentLogs(50);
762-
```
763-
764-
### Notifications
765-
766-
Display notifications using the built-in notification service:
767-
```csharp
768-
windowSystem.NotificationStateService.ShowNotification(
769-
title: "Success",
770-
message: "Operation completed",
771-
severity: NotificationSeverity.Success,
772-
blockUi: false,
773-
timeout: 5000);
774-
```
775-
776-
Severity levels: `Info`, `Success`, `Warning`, `Danger`, `None`
704+
### Important: No Console Output
705+
**Do not use `Console.WriteLine()`, `Console.Write()`, or console logging providers** — they corrupt the UI rendering. Use the built-in `LogService` or file-based logging instead.
777706

778707
## License
779708

780709
This project is licensed under the MIT License - see the [LICENSE.txt](LICENSE.txt) file for details.
781710

782711
## Acknowledgments
783712

784-
- Built on [Spectre.Console](https://github.com/spectreconsole/spectre.console) for rich console output
785-
- Inspired by traditional GUI frameworks adapted for console applications
713+
- Built on [Spectre.Console](https://github.com/spectreconsole/spectre.console) for rich console rendering
714+
- Unix raw I/O approach inspired by [Terminal.Gui v2](https://github.com/gui-cs/Terminal.Gui)
786715

787716
## Documentation
788717

789718
Detailed documentation is available in separate guides:
790719

791-
- **[Configuration Guide](docs/CONFIGURATION.md)** - Complete system configuration reference
792-
- **[Status System](docs/STATUS_SYSTEM.md)** - Status bars, window task bar, and Start Menu
793-
- **[Controls Reference](docs/CONTROLS.md)** - Complete guide to all 25+ UI controls
720+
- **[Examples Gallery](docs/EXAMPLES.md)** - All examples with screenshots
721+
- **[Fluent Builders](docs/BUILDERS.md)** - WindowBuilder and control builder APIs
722+
- **[Controls Reference](docs/CONTROLS.md)** - Complete guide to all 30+ UI controls
794723
- **[Built-in Dialogs](docs/DIALOGS.md)** - File pickers, folder browsers, and system dialogs
724+
- **[Configuration Guide](docs/CONFIGURATION.md)** - Complete system configuration reference
795725
- **[Theme System](docs/THEMES.md)** - Built-in themes, custom themes, and runtime switching
796-
- **[Plugin Development](docs/PLUGINS.md)** - Creating custom plugins and using the plugin architecture
797726
- **[State Services](docs/STATE-SERVICES.md)** - Window state, focus, modal, and notification services
798-
- **[Fluent Builders](docs/BUILDERS.md)** - WindowBuilder and control builder APIs
727+
- **[Plugin Development](docs/PLUGINS.md)** - Creating custom plugins and using the plugin architecture
728+
- **[Compositor Effects](docs/COMPOSITOR_EFFECTS.md)** - Buffer manipulation, transitions, and visual effects
729+
- **[Portal System](docs/PORTAL_SYSTEM.md)** - Floating portals and overlay system
730+
- **[DOM Layout System](docs/DOM_LAYOUT_SYSTEM.md)** - Layout engine internals
731+
- **[Rendering Pipeline](docs/RENDERING_PIPELINE.md)** - Rendering architecture details
732+
- **[Status System](docs/STATUS_SYSTEM.md)** - Status bars, window task bar, and Start Menu
799733

800734
## Links
801735

@@ -812,9 +746,14 @@ Real-world applications built with SharpConsoleUI:
812746
|---------|-------------|
813747
| **[ServerHub](https://github.com/nickprotop/ServerHub)** | A terminal-based control panel for Linux servers and homelabs. Features 14 bundled widgets for monitoring CPU, memory, disk, network, Docker containers, systemd services, and more. Supports custom widgets in any language and context-aware actions. |
814748
| **[LazyNuGet](https://github.com/nickprotop/lazynuget)** | A terminal-based NuGet package manager for .NET solutions. Search, install, update, and manage NuGet dependencies across projects with multi-source support, dependency tree visualization, and cross-platform binaries. |
749+
| **[LazyDotIDE](https://github.com/nickprotop/lazydotide)** | A lightweight console-based .NET IDE with LSP IntelliSense, built-in terminal, and git integration. Works over SSH, in containers, anywhere you have a console. |
815750

816751
*Using SharpConsoleUI in your project? Open a PR to add it to this list!*
817752

753+
## Development Notes
754+
755+
SharpConsoleUI was initially developed manually with core windowing functionality and double-buffered rendering. The project evolved to include modern features (DOM-based layout system, fluent builders, plugin architecture, theme system) with AI assistance. Architectural decisions and feature design came from the project author, while AI generated code implementations based on those decisions.
756+
818757
---
819758

820759
**Made for the .NET console development community**

0 commit comments

Comments
 (0)