Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .aider.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Terminal.Gui v2 is a **complete rewrite**. Pre-2025 training data about Terminal
dotnet restore
dotnet build --no-restore
dotnet test --project Tests/UnitTestsParallelizable --no-build
dotnet test --project Tests/UnitTests --no-build
dotnet test --project Tests/UnitTests.NonParallelizable --no-build
```

---
Expand Down
2 changes: 1 addition & 1 deletion .claude/REFRESH.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
3. **Use `[...]`** not `new () { ... }` for collections
4. **SubView/SuperView** - never say "child", "parent", or "container"
5. **Unused lambda params** - use `_` discard: `(_, _) => { }`
6. **Local functions** - use camelCase: `void myLocalFunc ()`
6. **Local functions** - use PascalCase: `void MyLocalFunc ()`
7. **Backing fields** - place immediately before their property (ReSharper bug, must do manually)
8. **SPACE BEFORE PARENTHESES** - `Method ()` not `Method()`, `array [i]` not `array[i]` (see `formatting.md`)
9. **Braces on next line** - ALL opening braces on next line (Allman style)
Expand Down
25 changes: 16 additions & 9 deletions .claude/tasks/build-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ public sealed class MainWindow : Runnable

// Add controls here
Button button = new () { Text = "Click Me", X = Pos.Center (), Y = Pos.Center () };
button.Accepting += (_, e) =>
button.Accepted += (_, _) =>
{
MessageBox.Query (App!, "Hello", "Button clicked!", "OK");
e.Handled = true;
};

Add (button);
Expand All @@ -80,11 +79,10 @@ public sealed class LoginWindow : Runnable<string?>
{
// ... setup UI ...

loginButton.Accepting += (_, e) =>
loginButton.Accepted += (_, _) =>
{
Result = usernameField.Text; // Set return value
App!.RequestStop (); // Close window
e.Handled = true;
};
}
}
Expand Down Expand Up @@ -150,10 +148,19 @@ See `.claude/cookbook/common-patterns.md` for recipes including:

### Button Click
```csharp
button.Accepting += (sender, e) =>
// Simple side-effect handler — use Accepted (post-event)
button.Accepted += (_, _) =>
{
// Handle the click
e.Handled = true; // Prevent further processing
};

// Use Accepting (pre-event) ONLY to inspect or cancel the in-flight action
button.Accepting += (_, e) =>
{
if (!CanProceed ())
{
e.Handled = true; // Cancel — prevents Accepted from firing
}
};
```

Expand Down Expand Up @@ -200,7 +207,7 @@ Dialog dialog = new ()
Title = "Custom Dialog",
Width = 40,
Height = 10,
Buttons = [new Button ("OK"), new Button ("Cancel")]
Buttons = [new Button { Text = "OK" }, new Button { Text = "Cancel" }]
};
// Add controls to dialog...
app.Run (dialog);
Expand Down Expand Up @@ -241,12 +248,12 @@ Available themes: `Default`, `Dark`, `Light`, `Amber Phosphor`, `Green Phosphor`
- [ ] Main window class inheriting from `Runnable` or `Runnable<T>`
- [ ] Application lifecycle: Create -> Init -> Run -> Dispose
- [ ] Layout using Pos/Dim (not hardcoded positions)
- [ ] Event handlers with `e.Handled = true` when appropriate
- [ ] `-ed` events (`Accepted`) for side effects; `-ing` events (`Accepting`) only to cancel
- [ ] Proper cleanup with `Dispose` pattern

## What NOT to Do

- Don't use `Application.Init()` / `Application.Shutdown()` (legacy static API)
- Don't hardcode sizes - use `Dim.Fill()`, `Dim.Auto()`, `Dim.Percent()`
- Don't forget `e.Handled = true` in Accepting handlers
- Don't use `Accepting` for fire-and-forget side effects - use `Accepted`; reserve `Accepting` (with `e.Handled = true`) for canceling
- Don't block the main thread - use `Application.AddTimeout` for async work
2 changes: 1 addition & 1 deletion .claude/tasks/clean-code-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ Run these for each commit:
```bash
dotnet build --no-restore
dotnet test --project Tests/IntegrationTests --no-build
dotnet test --project Tests/UnitTests --no-build
dotnet test --project Tests/UnitTestsParallelizable --no-build
dotnet test --project Tests/UnitTests.NonParallelizable --no-build
```

## Terminal.Gui Specific Requirements
Expand Down
10 changes: 5 additions & 5 deletions .claude/workflows/build-test-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

## Required Tools

- **.NET SDK**: 8.0.0 (see `global.json`)
- **Runtime**: .NET 8.x (latest GA)
- **.NET SDK**: 10.0.100 (see `global.json`)
- **Runtime**: .NET 10.x (latest GA)
Comment thread
tig marked this conversation as resolved.
- **Optional**: ReSharper/Rider for code formatting (honor `.editorconfig` and `Terminal.sln.DotSettings`)

## Build Commands
Expand Down Expand Up @@ -47,7 +47,7 @@ dotnet build --configuration Release --no-restore
**Time:** ~10 min timeout

```bash
dotnet test --project Tests/UnitTests --no-build --verbosity normal
dotnet test --project Tests/UnitTests.NonParallelizable --no-build --verbosity normal
```

- Uses `Application.Init` and static state
Expand Down Expand Up @@ -75,7 +75,7 @@ dotnet test --project Tests/IntegrationTests --no-build --verbosity normal
### Run All Tests

```bash
dotnet test --project Tests/UnitTests --no-build --verbosity normal && dotnet test --project Tests/UnitTestsParallelizable --no-build --verbosity normal
dotnet test --project Tests/UnitTestsParallelizable --no-build --verbosity normal && dotnet test --project Tests/UnitTests.NonParallelizable --no-build --verbosity normal
```

## Common Build Issues
Expand All @@ -94,7 +94,7 @@ dotnet publish ./Tests/NativeAotSmoke/NativeAotSmoke.csproj --configuration Rele
**For clean builds, always run in this order:**

```bash
dotnet restore && dotnet build --no-restore && dotnet test --project Tests/UnitTests --no-build && dotnet test --project Tests/UnitTestsParallelizable --no-build
dotnet restore && dotnet build --no-restore && dotnet test --project Tests/UnitTestsParallelizable --no-build && dotnet test --project Tests/UnitTests.NonParallelizable --no-build
```

This ensures:
Expand Down
6 changes: 3 additions & 3 deletions .claude/workflows/pr-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Before submitting a PR, ensure:

- [ ] **Build passes** locally: `dotnet build --no-restore`

- [ ] **Tests pass** locally: `dotnet test --project Tests/UnitTests --no-build && dotnet test --project Tests/UnitTestsParallelizable --no-build`
- [ ] **Tests pass** locally: `dotnet test --project Tests/UnitTestsParallelizable --no-build && dotnet test --project Tests/UnitTests.NonParallelizable --no-build`

## PR Description Template

Expand Down Expand Up @@ -70,7 +70,7 @@ dotnet build --configuration Debug --no-restore
### 2. Run Tests

```bash
dotnet test --project Tests/UnitTests --no-build --verbosity normal && dotnet test --project Tests/UnitTestsParallelizable --no-build --verbosity normal
dotnet test --project Tests/UnitTestsParallelizable --no-build --verbosity normal && dotnet test --project Tests/UnitTests.NonParallelizable --no-build --verbosity normal
```

**Expected:** All tests pass
Expand Down Expand Up @@ -106,7 +106,7 @@ git diff
- ❌ Don't modify unrelated code
- ❌ Don't remove/edit unrelated tests
- ❌ Don't break existing functionality
- ❌ Don't add tests to `UnitTests` if they can be parallelizable
- ❌ Don't add tests to `UnitTests.NonParallelizable` if they can be parallelizable; never add tests to `UnitTests.Legacy`
- ❌ Don't decrease code coverage
- ❌ Don't introduce new warnings
- ❌ Don't include commented-out code without explanation
Expand Down
2 changes: 1 addition & 1 deletion .cursorrules
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Terminal.Gui v2 is a **complete rewrite**. Pre-2025 training data about Terminal
dotnet restore
dotnet build --no-restore
dotnet test --project Tests/UnitTestsParallelizable --no-build
dotnet test --project Tests/UnitTests --no-build
dotnet test --project Tests/UnitTests.NonParallelizable --no-build
```

---
Expand Down
16 changes: 8 additions & 8 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ dotnet build --no-restore

# Run all tests (two separate projects)
dotnet test --project Tests/UnitTestsParallelizable --no-build
dotnet test --project Tests/UnitTests --no-build
dotnet test --project Tests/UnitTests.NonParallelizable --no-build

# Run a single test by fully-qualified name
dotnet test --project Tests/UnitTestsParallelizable --no-build --filter "FullyQualifiedName~MyTestClass.MyTestMethod"
# Run a single test by method name (xUnit v3 / Microsoft Testing Platform)
dotnet test --project Tests/UnitTestsParallelizable --no-build --filter-method "*MyTestMethod"

# Run tests matching a trait or pattern
dotnet test --project Tests/UnitTestsParallelizable --no-build --filter "ClassName~ButtonTests"
# Run all tests in a class
dotnet test --project Tests/UnitTestsParallelizable --no-build --filter-class "*ButtonTests"
```

New tests go in `Tests/UnitTestsParallelizable` (no static state dependencies). Only use `Tests/UnitTests` when testing `Application.Init`/`Shutdown` or other static state.
New tests go in `Tests/UnitTestsParallelizable` (no static state dependencies). Only use `Tests/UnitTests.NonParallelizable` when testing `Application.Init`/`Shutdown` or other static state. Never add new tests to `Tests/UnitTests.Legacy`.

## Architecture Overview

Expand Down Expand Up @@ -191,10 +191,10 @@ All opening braces go on the next line. No exceptions.
textField.TextChanged += (_, _) => { /* ... */ };
```

### Local functions use camelCase
### Local functions use PascalCase

```csharp
void myLocalFunc () { }
void MyLocalFunc () { }
```

### Backing fields directly above their property
Expand Down
2 changes: 1 addition & 1 deletion .windsurfrules
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Terminal.Gui v2 is a **complete rewrite**. Pre-2025 training data about Terminal
dotnet restore
dotnet build --no-restore
dotnet test --project Tests/UnitTestsParallelizable --no-build
dotnet test --project Tests/UnitTests --no-build
dotnet test --project Tests/UnitTests.NonParallelizable --no-build
```

---
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ dotnet run
**Terminal.Gui** - Cross-platform console UI toolkit for .NET (C# 14, net10.0)

**Build:** `dotnet restore && dotnet build --no-restore`
**Test:** `dotnet test --project Tests/UnitTests --no-build && dotnet test --project Tests/UnitTestsParallelizable --no-build`
**Test:** `dotnet test --project Tests/UnitTestsParallelizable --no-build && dotnet test --project Tests/UnitTests.NonParallelizable --no-build`
**Details:** [Build & Test Workflow](.claude/workflows/build-test-workflow.md)

### xUnit v3 Test Filtering (Microsoft Testing Platform)
Expand Down Expand Up @@ -145,7 +145,7 @@ Process guides in `.claude/workflows/`:
## Planning Mode

When creating implementation plans:
- **Create plan files in `./plans/`** (relative to repository root: `D:\s\gui-cs\Terminal.Gui\plans\`)
- **Create plan files in `./plans/`** (relative to the repository root)
- Use markdown format with clear sections
- Include: problem statement, implementation steps, file changes, verification steps
- Reference existing patterns and reuse opportunities from exploration
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Welcome! This guide provides everything you need to know to contribute effective

1. **Non-parallel tests** (depend on static state, ~10 min timeout):
```bash
dotnet test --project Tests/UnitTests --no-build --verbosity normal
dotnet test --project Tests/UnitTests.NonParallelizable --no-build --verbosity normal
```
- Uses `Application.Init` and static state
- Cannot run in parallel
Expand Down
Loading