Skip to content

Commit 47367f4

Browse files
authored
Merge pull request #216 from gui-cs/release/v2.2.5
Release v2.2.5
2 parents b107dd2 + 1183b37 commit 47367f4

13 files changed

Lines changed: 111 additions & 1144 deletions

docs/images/hero.gif

-4.25 MB
Loading

examples/ted/EditorSettingsDialog.cs

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Terminal.Gui.Editor;
2+
using Terminal.Gui.Resources;
23
using Terminal.Gui.Text.Indentation;
34
using Terminal.Gui.ViewBase;
45
using Terminal.Gui.Views;
@@ -8,29 +9,27 @@ namespace Ted;
89
internal sealed class EditorSettingsDialog : Dialog
910
{
1011
private readonly CheckBox _autoCompleteCheck;
11-
private readonly CheckBox _autoIndentCheck;
12-
private readonly CheckBox _convertTabsCheck;
1312
private readonly NumericUpDown<int> _indentSize;
13+
private readonly CheckBox _convertTabsCheck;
14+
private readonly CheckBox _autoIndentCheck;
1415

1516
internal EditorSettingsDialog (Editor editor)
1617
{
1718
Title = "Settings";
1819
Width = Dim.Percent (60);
19-
Height = 18;
20+
Height = 13;
2021

22+
// --- Tab Settings tab ---
2123
View tabSettingsTab = new ()
2224
{
23-
Title = "_Tab Settings",
24-
Width = Dim.Fill (),
25-
Height = Dim.Fill ()
25+
Title = "_Tab Settings"
2626
};
2727

28+
View label = new Label { Text = "_Indent size:" };
2829
_indentSize = new NumericUpDown<int>
2930
{
30-
X = 20,
31-
Y = 1,
32-
Value = editor.IndentationSize,
33-
Width = 8
31+
X = Pos.Right (label) + 1,
32+
Value = editor.IndentationSize
3433
};
3534
_indentSize.ValueChanging += (_, e) =>
3635
{
@@ -42,67 +41,52 @@ internal EditorSettingsDialog (Editor editor)
4241

4342
_convertTabsCheck = new CheckBox
4443
{
45-
X = 1,
46-
Y = 3,
44+
Y = Pos.Bottom (_indentSize),
4745
Title = "Con_vert Tabs to Spaces",
4846
Value = editor.ConvertTabsToSpaces ? CheckState.Checked : CheckState.UnChecked
4947
};
5048

5149
_autoIndentCheck = new CheckBox
5250
{
53-
X = 1,
54-
Y = 5,
51+
Y = Pos.Bottom (_convertTabsCheck),
5552
Title = "_Auto Indent",
5653
Value = editor.IndentationStrategy is not null ? CheckState.Checked : CheckState.UnChecked
5754
};
5855

5956
tabSettingsTab.Add (
60-
new Label { X = 1, Y = 1, Text = "_Indent size:" },
57+
label,
6158
_indentSize,
6259
_convertTabsCheck,
6360
_autoIndentCheck);
6461

6562
_autoCompleteCheck = new CheckBox
6663
{
67-
X = 1,
68-
Y = 1,
69-
Title = "Auto _Complete (Ctrl+Space)",
64+
Title = "Auto _Complete",
7065
Value = editor.CompletionProvider is not null ? CheckState.Checked : CheckState.UnChecked
7166
};
7267

68+
// --- Config tab ---
7369
View configTab = new ()
7470
{
75-
Title = "_Config",
76-
Width = Dim.Fill (),
77-
Height = Dim.Fill ()
71+
Title = "_Config"
7872
};
7973

8074
configTab.Add (_autoCompleteCheck);
8175

82-
Tabs tabs = new ()
83-
{
84-
X = 0,
85-
Y = 0,
86-
Width = Dim.Fill (),
87-
Height = Dim.Fill (2)
88-
};
76+
// --- Tabs ---
77+
Tabs tabs = new ();
8978

9079
tabs.InsertTab (0, configTab);
9180
tabs.InsertTab (1, tabSettingsTab);
9281

9382
Button okBtn = new ()
9483
{
95-
Text = "OK",
96-
X = Pos.Center () - 6,
97-
Y = Pos.Bottom (tabs),
98-
IsDefault = true
84+
Text = Strings.btnOk
9985
};
10086

10187
Button cancelBtn = new ()
10288
{
103-
Text = "Cancel",
104-
X = Pos.Right (okBtn) + 2,
105-
Y = Pos.Bottom (tabs)
89+
Text = Strings.btnCancel
10690
};
10791

10892
okBtn.Accepting += (_, _) =>
@@ -112,7 +96,10 @@ internal EditorSettingsDialog (Editor editor)
11296
};
11397

11498
cancelBtn.Accepting += (_, _) => RequestStop ();
115-
Add (tabs, okBtn, cancelBtn);
99+
100+
AddButton (cancelBtn);
101+
AddButton (okBtn);
102+
Add (tabs);
116103
}
117104

118105
internal bool WasAccepted { get; private set; }

examples/ted/TedApp.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// This is a demo of ted, the Terminal.Gui.Editor example.
2+
13
using System.Text;
24
using Terminal.Gui.App;
35
using Terminal.Gui.Configuration;

scripts/HERO-GIF.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Hero GIF Recording Guide
2+
3+
Produces `docs/images/hero.gif` — a high-quality animated GIF demonstrating ted's key features.
4+
5+
## Prerequisites
6+
7+
- [tuirec](https://github.com/gui-cs/tuirec) v0.3.4+ on PATH (`go install github.com/gui-cs/tuirec/cmd/tuirec@latest`)
8+
- .NET 10 SDK (for building ted)
9+
- `agg` is auto-downloaded by tuirec on first use
10+
11+
## Build ted
12+
13+
```powershell
14+
dotnet build examples/ted -c Debug --nologo
15+
```
16+
17+
## Record
18+
19+
```powershell
20+
$binary = "C:/Users/Tig/s/gui-cs/Editor/examples/ted/bin/Debug/net10.0/ted.exe"
21+
$file = "./examples/ted/TedApp.cs"
22+
23+
# Keystroke script — demonstrates typing, scrolling, folding, search, selection+indent,
24+
# undo, themes, settings (autocomplete enable), autocomplete popup, disable autocomplete,
25+
# and About box.
26+
# Pacing: --keystroke-delay 50 (very fast, snappy feel).
27+
$ks = 'wait:300,`// This is a demo of ted, the Terminal.Gui.Editor example app`,Enter,wait:300,PageDown,wait:80,PageDown,wait:80,PageDown,wait:200,Home,wait:300,click:5:23,wait:400,click:5:23,wait:200,PageDown,wait:80,PageDown,wait:80,PageDown,wait:80,PageDown,wait:80,PageDown,wait:80,PageDown,wait:200,Ctrl+F,wait:200,`SaveView`,wait:200,Enter,wait:250,Esc,wait:200,PageDown,wait:80,PageDown,wait:200,click:8:14,wait:150,Shift+CursorDown,Shift+CursorDown,Shift+CursorDown,Shift+CursorDown,wait:200,Tab,wait:250,Ctrl+Z,Ctrl+Z,Ctrl+Z,Ctrl+Z,Ctrl+Z,wait:250,click:20:30,wait:200,CursorDown,CursorDown,CursorDown,Enter,wait:400,click:20:30,wait:200,CursorDown,CursorDown,Enter,wait:400,click:20:30,wait:200,CursorUp,Enter,wait:400,F9,wait:150,CursorRight,CursorRight,CursorRight,Enter,wait:200,Enter,wait:250,Space,wait:150,Enter,wait:250,`Save`,wait:200,Ctrl+Space,wait:400,Esc,wait:200,Ctrl+Z,Ctrl+Z,Ctrl+Z,Ctrl+Z,Ctrl+Z,Ctrl+Z,Ctrl+Z,Ctrl+Z,Ctrl+Z,Ctrl+Z,wait:250,F9,wait:150,CursorRight,CursorRight,CursorRight,Enter,wait:200,Enter,wait:250,Space,wait:150,Enter,wait:250,click:29:1,wait:200,Enter,wait:800,Esc,wait:200,Esc,wait:200,Tab,Tab,Enter'
28+
29+
tuirec record `
30+
--binary $binary `
31+
--args $file `
32+
--name "hero" `
33+
--show-command '$ ted ./examples/ted/TedApp.cs' `
34+
--keystrokes $ks `
35+
--startup-delay 2000 `
36+
--drain 2000 `
37+
--cols 120 `
38+
--rows 30 `
39+
--keystroke-delay 50 `
40+
--max-duration 60 `
41+
--cast-output ./artifacts/hero.cast `
42+
--verbosity high
43+
44+
# Copy to final location
45+
Copy-Item ./artifacts/hero.gif ./docs/images/hero.gif -Force
46+
```
47+
48+
## Demo sequence
49+
50+
| Time | Feature | Keys / Actions |
51+
|--------|-----------------------|----------------------------------------------------------|
52+
| 0-2s | File load + highlight | `$ ted ./examples/ted/TedApp.cs` typed, file opens |
53+
| 2-5s | Type comment line | Types `// This is a demo of ted, the Terminal.Gui.Editor example app` + Enter |
54+
| 5-6s | Scrolling | PageDown×3 then Home (show file navigation) |
55+
| 6-7s | Folding | Click fold gutter at row 23 (collapse/expand class body) |
56+
| 7-9s | Scroll to mid-file | 6× PageDown |
57+
| 9-11s | Search | Ctrl+F → type "SaveView" → Enter (find next) → Esc |
58+
| 11-13s | Selection + indent | Click col 8 + Shift+Down×4 to select, Tab to indent |
59+
| 13-14s | Undo | Ctrl+Z×5 to revert indent |
60+
| 14-17s | Theme switching | Theme dropdown → Anders → Green Phosphor → Dark |
61+
| 17-19s | Settings dialog | F9 → Options → Settings → enable autocomplete → OK |
62+
| 19-21s | Autocomplete | Type "Save" → Ctrl+Space → popup shown → Esc |
63+
| 19-20s | Disable autocomplete | F9 → Options → Settings → uncheck autocomplete → OK |
64+
| 20-22s | About box + Quit | Click Help → Enter → shown ~1s → Esc → Esc (quit) |
65+
66+
## Tuning tips
67+
68+
- **Fold target**: Line 22 (`{` of `TedApp : Window` class body) — always visible at row 23 in the initial 30-row view. Click col 5 for the fold gutter.
69+
- **Theme dropdown**: Located at approximately col 20, row 30 (status bar, last row). Items listed top-to-bottom: Default, 8-Bit, Amber Phosphor, Anders, Dark, Green Phosphor, Light, TurboPascal 5.
70+
- After selecting Anders (3 Down from Default), reopening shows Anders highlighted. From Anders: 2 Down = Green Phosphor. From Green Phosphor: 1 Up = Dark.
71+
- **Help menu position**: "Help" is at col 29 in the menu bar (row 1). Use `click:29:1` to open it. The only item is "About ted…"; press Enter to select.
72+
- **Settings dialog**: Reached via F9 (menu bar focus) → 3× CursorRight (to Options) → Enter → Enter (Settings is the only item). First tab has "Auto Complete" checkbox. Space toggles, Enter confirms OK.
73+
- **Quit key is Esc** (not Ctrl+Q). Esc closes the topmost overlay first (search bar, popup, dialog), then quits the app when nothing is open. If the document is dirty, a "Save changes?" dialog appears with buttons [Cancel, Don't Save, Save] (Save focused). Press Tab,Tab,Enter to select "Don't Save".
74+
- **`--kitty-keyboard` does NOT work** for navigation keys (CursorDown, PageDown, etc.) with current Terminal.Gui. Do NOT use this flag. Standard VT100 sequences work.
75+
- **Multi-caret via Ctrl+Alt+Down** is unreliable without kitty keyboard. Use Shift+Down selection + Tab for indent demos instead.
76+
- **After search**: the viewport centers on the found text. Budget additional PageDown presses to reach content below the match.
77+
78+
## Troubleshooting
79+
80+
1. **Keys not registering**: Use `--verbosity high` and check the escape sequences in stderr output. Without `--kitty-keyboard`, navigation uses standard VT100 sequences (`\x1b[B` for CursorDown, `\x1b[6~` for PageDown) which Terminal.Gui recognizes.
81+
2. **Wrong click targets**: Do a discovery recording first — short script with just `wait:2000,Ctrl+Q`, then examine the `.cast` file to find column positions of UI elements.
82+
3. **Theme dropdown doesn't open**: Verify the col:row coordinates match the "Theme" shortcut in the status bar. Parse the `.cast` for the "Default" text position.
83+
4. **About dialog not appearing**: Use `click:29:1` (Help menu at col 29, row 1) instead of F9+CursorRight×4. After complex keystroke sequences, F9 menu navigation can be unreliable.
84+
5. **File stays dirty after undos**: The autocomplete popup may auto-insert text beyond what you typed. Use 10+ Ctrl+Z to be safe, and handle the "Save changes?" dialog at quit with Tab,Tab,Enter.
85+
6. **Recording too long**: Reduce `wait:` values or lower `--keystroke-delay`. Current recording is ~22s at delay 50.
86+
7. **GIF too large**: The `agg` renderer produces ~0.5-2 MB GIFs at 120×30. For smaller files, reduce terminal dimensions.

scripts/README.md

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)