Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
776509cc6c | ||
|
|
a66d2a19e4 | ||
|
|
68b727f38a | ||
|
|
e5c10afd94 | ||
|
|
fc97e04846 |
+24
-7
@@ -513,23 +513,40 @@ ETTerms_v0.2.0\
|
||||
```
|
||||
|
||||
**規則:**
|
||||
1. **GUI publish 會自動帶上 MCP**:`ETTerms.csproj` 有 `PublishSerialMcp` target(`AfterTargets="Publish"`),會把 `ETTerms.SerialMcp` 一併發佈到 `ETTerms_v{Version}\ETTerms.SerialMcp\` **子資料夾**(與 GUI 相依 dll 隔離)。因此**只要發佈 GUI 一個指令**即可,不必再單獨發 MCP。
|
||||
1. **GUI publish 會自動帶上 MCP**:`ETTerms.csproj` 有 `PublishSerialMcp` target(`AfterTargets="Publish"`),會把 `ETTerms.SerialMcp` 一併發佈到 `<publish>\ETTerms.SerialMcp\` **子資料夾**(與 GUI 相依 dll 隔離)。因此**只要發佈 GUI 一個指令**即可,不必再單獨發 MCP。
|
||||
- 對齊 `McpRegistrar.ResolveServerExe()`:它解析的 `<ETTerms.exe>\ETTerms.SerialMcp\ETTerms.SerialMcp.exe` 因此**必定存在**,AI MCP 一鍵設定寫進去的路徑才不會落空。
|
||||
- MCP 子發佈會**跟隨 GUI 的 `SelfContained` 設定**(target 內以 `$(SelfContained)` 傳入):框架相依版的 MCP 也框架相依;portable 版的 MCP 也免 runtime。
|
||||
2. **主 exe 改名**:`dotnet publish` 產生的 `ETTerms.exe` 重新命名為 **`ETTerms v{Version}.exe`**。
|
||||
- 可安全改名:.NET apphost 內部記錄要載入的 `ETTerms.dll`,**不靠自身檔名**,改名後仍正常啟動。
|
||||
3. **框架相依**:`--self-contained false -r win-x64`(目標機需已裝 .NET 8 Desktop Runtime)。
|
||||
|
||||
**PowerShell 範例:**
|
||||
### 兩種發佈版本(兩個都要產出)
|
||||
|
||||
| 版本 | 資料夾 | 指令旗標 | 需 .NET Runtime? | 用途 |
|
||||
|------|--------|----------|-------------------|------|
|
||||
| **A. 框架相依(預設)** | `ETTerms_v{Version}\` | `--self-contained false` | ✅ 需先裝 .NET 8 Desktop Runtime | 體積小;給已具備 runtime 的環境 |
|
||||
| **B. Portable(免安裝)** | `ETTerms_v{Version}_portable\` | `--self-contained true` | ❌ 不需要,runtime 已內含 | 體積大(約 240MB);給受 MIS 管控、不便裝 runtime 的環境,解壓即用、免系統管理員權限 |
|
||||
|
||||
> ⚠️ **不要開 trimming**(`PublishTrimmed`):WinForms 大量用反射,trim 後易在執行時出錯。
|
||||
|
||||
**PowerShell 範例(一次產出兩種):**
|
||||
```powershell
|
||||
$ver = ([regex]::Match((Get-Content src\ETTerms\ETTerms.csproj -Raw), '<Version>([^<]+)</Version>')).Groups[1].Value
|
||||
$root = "src\ETTerms\Publish\ETTerms_v$ver"
|
||||
if (Test-Path $root) { Remove-Item $root -Recurse -Force }
|
||||
$ver = ([regex]::Match((Get-Content src\ETTerms\ETTerms.csproj -Raw), '<Version>([^<]+)</Version>')).Groups[1].Value
|
||||
|
||||
# 發佈 GUI;ETTerms.SerialMcp 由 PublishSerialMcp target 自動發到 $root\ETTerms.SerialMcp\
|
||||
# A. 框架相依版 → ETTerms_v{Version}\
|
||||
$root = "src\ETTerms\Publish\ETTerms_v$ver"
|
||||
if (Test-Path $root) { Remove-Item $root -Recurse -Force }
|
||||
dotnet publish src\ETTerms\ETTerms.csproj -c Release -r win-x64 --self-contained false -o $root
|
||||
Rename-Item (Join-Path $root "ETTerms.exe") "ETTerms v$ver.exe"
|
||||
|
||||
# B. Portable 免安裝版 → ETTerms_v{Version}_portable\(runtime 已內含;MCP 也跟著 self-contained)
|
||||
$proot = "src\ETTerms\Publish\ETTerms_v${ver}_portable"
|
||||
if (Test-Path $proot) { Remove-Item $proot -Recurse -Force }
|
||||
dotnet publish src\ETTerms\ETTerms.csproj -c Release -r win-x64 --self-contained true -o $proot
|
||||
Rename-Item (Join-Path $proot "ETTerms.exe") "ETTerms v$ver.exe"
|
||||
```
|
||||
|
||||
> 兩版的 `ETTerms.SerialMcp\` 子資料夾都由 `PublishSerialMcp` target 自動產生;portable 版的 MCP 也是 self-contained,故 AI MCP 功能在無 runtime 環境同樣可用。
|
||||
|
||||
---
|
||||
|
||||
## Development Phases
|
||||
|
||||
@@ -40,14 +40,21 @@ dotnet run --project src\ETTerms\ETTerms.csproj
|
||||
# 加套件
|
||||
dotnet add src\ETTerms package SSH.NET
|
||||
|
||||
# 打包(見「Publish / 打包慣例」,輸出固定到 src\ETTerms\Publish\ETTerms_v{Version}\)
|
||||
# 打包(見「Publish / 打包慣例」)—— 兩種版本都產出,輸出到 src\ETTerms\Publish\
|
||||
# GUI publish 會「自動」把 ETTerms.SerialMcp 一併發到 \ETTerms.SerialMcp\ 子資料夾
|
||||
# (ETTerms.csproj 的 PublishSerialMcp target,AfterTargets=Publish),不必再單獨發 MCP。
|
||||
# (ETTerms.csproj 的 PublishSerialMcp target,AfterTargets=Publish),且 MCP 跟隨 GUI 的 self-contained 設定。
|
||||
$ver = ([regex]::Match((Get-Content src\ETTerms\ETTerms.csproj -Raw), '<Version>([^<]+)</Version>')).Groups[1].Value
|
||||
|
||||
# A. 框架相依版(需目標機已裝 .NET 8 Desktop Runtime)→ ETTerms_v{Version}\
|
||||
$root = "src\ETTerms\Publish\ETTerms_v$ver"
|
||||
dotnet publish src\ETTerms\ETTerms.csproj -c Release -r win-x64 --self-contained false -o $root
|
||||
Rename-Item (Join-Path $root "ETTerms.exe") "ETTerms v$ver.exe"
|
||||
|
||||
# B. Portable 免安裝版(runtime 內含,免裝、免管理員)→ ETTerms_v{Version}_portable\
|
||||
$proot = "src\ETTerms\Publish\ETTerms_v${ver}_portable"
|
||||
dotnet publish src\ETTerms\ETTerms.csproj -c Release -r win-x64 --self-contained true -o $proot
|
||||
Rename-Item (Join-Path $proot "ETTerms.exe") "ETTerms v$ver.exe"
|
||||
|
||||
# 註冊 Serial MCP server(給 AI agent 操作 serial)
|
||||
# 推薦:GUI Settings → AI MCP 分頁,對 Claude Code / Kiro 按 Setup 一鍵註冊(McpRegistrar)。
|
||||
# 或手動 CLI:
|
||||
@@ -57,7 +64,7 @@ kiro-cli mcp add --name serial --command dotnet --args "run --project src\ETTerm
|
||||
## 開發慣例
|
||||
|
||||
- **命名:** PascalCase 類別 / 方法,`_camelCase` 私有欄位;檔名 = 類別名。
|
||||
- **Publish / 打包:** 固定輸出到 `src\ETTerms\Publish\ETTerms_v{Version}\`(`{Version}` 取自 csproj `<Version>`);主 exe 改名為 `ETTerms v{Version}.exe`;`ETTerms.SerialMcp` 一併發到其下 `ETTerms.SerialMcp\` 子資料夾。框架相依(`--self-contained false -r win-x64`)。詳見 [ARCHITECTURE.md](ARCHITECTURE.md#publish--打包慣例)。
|
||||
- **Publish / 打包:** 輸出到 `src\ETTerms\Publish\`;主 exe 改名為 `ETTerms v{Version}.exe`;`ETTerms.SerialMcp` 一併發到其下 `ETTerms.SerialMcp\` 子資料夾(且跟隨 GUI 的 self-contained 設定)。**兩種版本都產出**:框架相依 `ETTerms_v{Version}\`(`--self-contained false`,需裝 .NET 8 Desktop Runtime)+ portable 免安裝 `ETTerms_v{Version}_portable\`(`--self-contained true`,runtime 內含)。不要開 trimming(WinForms 反射)。詳見 [ARCHITECTURE.md](ARCHITECTURE.md#publish--打包慣例)。
|
||||
- **分層:** UI(`App/`)只認 `ISessionChannel` 抽象,不直接相依 SSH.NET / SerialPort。
|
||||
- **執行緒:** channel I/O 在背景;所有 UI 更新一律 `Control.Invoke` 回 UI thread。
|
||||
- **commit:** 走 Conventional Commits(`feat:` / `fix:` / `refactor:` …)。
|
||||
|
||||
@@ -21,7 +21,7 @@ public sealed class AboutView : UserControl
|
||||
var left = new FlowLayoutPanel
|
||||
{
|
||||
Dock = DockStyle.Left, Width = 380, FlowDirection = FlowDirection.TopDown,
|
||||
WrapContents = false, AutoScroll = false, Padding = new Padding(20),
|
||||
WrapContents = false, AutoScroll = true, Padding = new Padding(20),
|
||||
BackColor = Theme.WorkspaceBack
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ public sealed class AboutView : UserControl
|
||||
{
|
||||
var header = new Label
|
||||
{
|
||||
AutoSize = false, Width = 500, Height = 22,
|
||||
AutoSize = true,
|
||||
Text = $"● v{entry.Version} · {entry.Title} ({entry.Date:yyyy-MM-dd})",
|
||||
ForeColor = Theme.Accent, Font = Theme.UiFontBold,
|
||||
Margin = new Padding(0, 8, 0, 2)
|
||||
@@ -83,7 +83,7 @@ public sealed class AboutView : UserControl
|
||||
{
|
||||
right.Controls.Add(new Label
|
||||
{
|
||||
AutoSize = false, Width = 500, Height = 20,
|
||||
AutoSize = true,
|
||||
Text = $" • {change}",
|
||||
ForeColor = Theme.Text, Font = Theme.UiFont,
|
||||
Margin = new Padding(0)
|
||||
@@ -99,18 +99,17 @@ public sealed class AboutView : UserControl
|
||||
|
||||
private static Panel MakeCard(int width, int height, Action<FlowLayoutPanel> build)
|
||||
{
|
||||
var card = new Panel
|
||||
// 卡片本身就是 TopDown 的 AutoSize FlowLayoutPanel:高度永遠長到容得下內容
|
||||
// (高 DPI 字變大也不會被裁),MinimumSize 維持 100% 的設計尺寸。
|
||||
var card = new FlowLayoutPanel
|
||||
{
|
||||
Width = width, Height = height, Margin = new Padding(0, 0, 0, 12),
|
||||
FlowDirection = FlowDirection.TopDown, WrapContents = false,
|
||||
AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink,
|
||||
MinimumSize = new Size(width, height),
|
||||
Margin = new Padding(0, 0, 0, 12),
|
||||
BackColor = Theme.TabBack, Padding = new Padding(12)
|
||||
};
|
||||
var flow = new FlowLayoutPanel
|
||||
{
|
||||
Dock = DockStyle.Fill, FlowDirection = FlowDirection.TopDown,
|
||||
WrapContents = false, BackColor = Theme.TabBack, AutoSize = false
|
||||
};
|
||||
build(flow);
|
||||
card.Controls.Add(flow);
|
||||
build(card);
|
||||
return card;
|
||||
}
|
||||
|
||||
@@ -149,24 +148,31 @@ public sealed class AboutView : UserControl
|
||||
{
|
||||
return new Label
|
||||
{
|
||||
AutoSize = false, Width = 310, Height = 20,
|
||||
AutoSize = true,
|
||||
Text = text, Font = font, ForeColor = color,
|
||||
TextAlign = align, Margin = new Padding(0)
|
||||
TextAlign = align, Margin = new Padding(0, 1, 0, 1)
|
||||
};
|
||||
}
|
||||
|
||||
private static Panel MakeRow(string label, string value)
|
||||
private static Control MakeRow(string label, string value)
|
||||
{
|
||||
var row = new Panel { Width = 310, Height = 20, Margin = new Padding(0, 2, 0, 0), BackColor = Color.Transparent };
|
||||
var row = new FlowLayoutPanel
|
||||
{
|
||||
AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink,
|
||||
FlowDirection = FlowDirection.LeftToRight, WrapContents = false,
|
||||
Margin = new Padding(0, 2, 0, 0), BackColor = Color.Transparent
|
||||
};
|
||||
row.Controls.Add(new Label
|
||||
{
|
||||
Text = value, AutoSize = false, Width = 230, Height = 20, Dock = DockStyle.Right,
|
||||
ForeColor = Theme.Text, Font = Theme.UiFont, TextAlign = ContentAlignment.MiddleRight
|
||||
Text = label, AutoSize = true, MinimumSize = new Size(70, 0),
|
||||
ForeColor = Theme.TextDim, Font = Theme.UiFont,
|
||||
TextAlign = ContentAlignment.MiddleLeft, Margin = new Padding(0, 0, 8, 0)
|
||||
});
|
||||
row.Controls.Add(new Label
|
||||
{
|
||||
Text = label, AutoSize = false, Width = 70, Height = 20, Dock = DockStyle.Left,
|
||||
ForeColor = Theme.TextDim, Font = Theme.UiFont, TextAlign = ContentAlignment.MiddleLeft
|
||||
Text = value, AutoSize = true,
|
||||
ForeColor = Theme.Text, Font = Theme.UiFont,
|
||||
TextAlign = ContentAlignment.MiddleLeft, Margin = new Padding(0)
|
||||
});
|
||||
return row;
|
||||
}
|
||||
@@ -177,6 +183,11 @@ public sealed class AboutView : UserControl
|
||||
|
||||
private static readonly ChangelogEntry[] Changelog =
|
||||
[
|
||||
new("0.2.2", new DateOnly(2026, 6, 5), "Bugfix — terminal stability",
|
||||
[
|
||||
"Fixed: the terminal no longer freezes after minimizing or switching tabs (notably in PowerShell / Kiro).",
|
||||
"Added: Shift+Enter inserts a newline in the shell, so you can type multi-line commands.",
|
||||
]),
|
||||
new("0.2.1", new DateOnly(2026, 6, 4), "AI MCP one-click setup",
|
||||
[
|
||||
"New Settings → AI MCP tab: register the Serial MCP server into Claude Code or Kiro with one click.",
|
||||
|
||||
@@ -17,7 +17,9 @@ public sealed class ActivityRail : UserControl
|
||||
private RailView _active = RailView.Terminal;
|
||||
private RailView? _hover;
|
||||
|
||||
private const int ItemSize = 56;
|
||||
private const int BaseItemSize = 56;
|
||||
/// <summary>依目前螢幕 DPI 縮放的格子大小(owner-draw 不會自動縮放像素,需自己換算)。</summary>
|
||||
private int ItemSize => (int)Math.Round(BaseItemSize * (DeviceDpi / 96.0));
|
||||
private static readonly (RailView view, string glyph, string tip)[] Items =
|
||||
{
|
||||
(RailView.Terminal, "▤", "Terminal"),
|
||||
@@ -37,6 +39,19 @@ public sealed class ActivityRail : UserControl
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
protected override void OnHandleCreated(EventArgs e)
|
||||
{
|
||||
base.OnHandleCreated(e);
|
||||
Width = ItemSize; // handle 建立後 DeviceDpi 才正確,依實際 DPI 重設寬度
|
||||
}
|
||||
|
||||
protected override void OnDpiChangedAfterParent(EventArgs e)
|
||||
{
|
||||
base.OnDpiChangedAfterParent(e);
|
||||
Width = ItemSize; // 拖到不同縮放的螢幕時跟著調整
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
[System.ComponentModel.DesignerSerializationVisibility(
|
||||
System.ComponentModel.DesignerSerializationVisibility.Hidden)]
|
||||
public RailView ActiveView
|
||||
|
||||
@@ -49,10 +49,11 @@ public sealed class ConnectionSidebar : UserControl
|
||||
BackColor = Theme.SidebarBack;
|
||||
|
||||
// ── Tab bar (Sessions / SFTP) ──
|
||||
// 高度 40 與右側 Workspace 工具列對齊,讓「CONNECTIONS / 連線清單」與右側分頁列同一條基準線
|
||||
var tabBar = new FlowLayoutPanel
|
||||
{
|
||||
Dock = DockStyle.Top, Height = 30, BackColor = Theme.RailBack,
|
||||
Padding = new Padding(4, 3, 4, 0), WrapContents = false
|
||||
Dock = DockStyle.Top, Height = 40, BackColor = Theme.RailBack,
|
||||
Padding = new Padding(4, 7, 4, 0), WrapContents = false
|
||||
};
|
||||
|
||||
var sessionsPanel = new Panel { Dock = DockStyle.Fill, BackColor = Theme.SidebarBack };
|
||||
@@ -63,7 +64,9 @@ public sealed class ConnectionSidebar : UserControl
|
||||
{
|
||||
var b = new Button
|
||||
{
|
||||
Text = text, Width = 70, Height = 24, FlatStyle = FlatStyle.Flat,
|
||||
Text = text, AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink,
|
||||
MinimumSize = new Size(70, 24), Padding = new Padding(8, 2, 8, 2),
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
ForeColor = Theme.Text, BackColor = Theme.TabBack, Font = Theme.UiFont,
|
||||
Margin = new Padding(0, 0, 4, 0), Cursor = Cursors.Hand
|
||||
};
|
||||
@@ -217,7 +220,9 @@ public sealed class ConnectionSidebar : UserControl
|
||||
var sshCombo = new ComboBox { Width = 120, DropDownStyle = ComboBoxStyle.DropDownList, BackColor = Theme.TabBack, ForeColor = Theme.Text, Font = Theme.UiFont };
|
||||
var connectBtn = new Button
|
||||
{
|
||||
Text = "Connect", Width = 64, Height = 24, FlatStyle = FlatStyle.Flat,
|
||||
Text = "Connect", AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink,
|
||||
MinimumSize = new Size(64, 24), Padding = new Padding(8, 2, 8, 2),
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
ForeColor = Theme.Text, BackColor = Theme.TabBack, Font = Theme.UiFont, Cursor = Cursors.Hand, Margin = new Padding(4, 0, 0, 0)
|
||||
};
|
||||
connectBtn.FlatAppearance.BorderColor = Theme.SerialColor;
|
||||
|
||||
Generated
+4
-2
@@ -18,8 +18,10 @@ partial class MainForm
|
||||
{
|
||||
SuspendLayout();
|
||||
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
// 用 Dpi 自動縮放:尺寸縮放比例 = 螢幕 DPI 比例,與點數字型的實際渲染比例一致,
|
||||
// 避免「字放大了、容器沒放大」造成的高 DPI 文字/按鈕被裁切。
|
||||
AutoScaleDimensions = new SizeF(96F, 96F);
|
||||
AutoScaleMode = AutoScaleMode.Dpi;
|
||||
ClientSize = new Size(1100, 700);
|
||||
MinimumSize = new Size(720, 480);
|
||||
BackColor = Theme.WorkspaceBack;
|
||||
|
||||
@@ -33,7 +33,9 @@ public sealed class SettingsView : UserControl
|
||||
|
||||
var b = new Button
|
||||
{
|
||||
Text = text, AutoSize = false, Width = 80, Height = 26, FlatStyle = FlatStyle.Flat,
|
||||
Text = text, AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink,
|
||||
MinimumSize = new Size(70, 26), Padding = new Padding(10, 2, 10, 2),
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
ForeColor = Theme.Text, BackColor = Theme.TabBack, Font = Theme.UiFont,
|
||||
Margin = new Padding(0, 0, 4, 0), Cursor = Cursors.Hand
|
||||
};
|
||||
@@ -432,25 +434,27 @@ public sealed class SettingsView : UserControl
|
||||
}
|
||||
|
||||
// ── Helpers ──
|
||||
private const int LabelWidth = 150; // 標籤欄固定寬度
|
||||
private const int LabelWidth = 150; // 標籤欄最小寬度
|
||||
private const int InputWidth = 200; // 所有輸入框統一寬度
|
||||
|
||||
private static Panel MakeRow(string label, Control control)
|
||||
private static Control MakeRow(string label, Control control)
|
||||
{
|
||||
var row = new Panel { Width = LabelWidth + InputWidth, Height = 32, Margin = new Padding(0, 3, 0, 3) };
|
||||
|
||||
// 統一輸入框寬度 + 左緣對齊(不再 Dock.Right,避免右對齊造成左緣參差)
|
||||
control.Width = InputWidth;
|
||||
int top = (row.Height - control.Height) / 2;
|
||||
control.Location = new Point(LabelWidth, top < 0 ? 0 : top);
|
||||
|
||||
row.Controls.Add(control);
|
||||
row.Controls.Add(new Label
|
||||
// 用 FlowLayout + AutoSize 標籤取代絕對定位,讓高 DPI 下標籤變寬也不會被裁、且對齊穩定
|
||||
var row = new FlowLayoutPanel
|
||||
{
|
||||
Text = label, AutoSize = false, Width = LabelWidth, Height = row.Height,
|
||||
Location = new Point(0, 0), ForeColor = Theme.Text, Font = Theme.UiFont,
|
||||
TextAlign = ContentAlignment.MiddleLeft
|
||||
});
|
||||
AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink,
|
||||
FlowDirection = FlowDirection.LeftToRight, WrapContents = false,
|
||||
Margin = new Padding(0, 3, 0, 3), BackColor = Color.Transparent
|
||||
};
|
||||
var lbl = new Label
|
||||
{
|
||||
Text = label, AutoSize = true, MinimumSize = new Size(LabelWidth, 0),
|
||||
ForeColor = Theme.Text, Font = Theme.UiFont,
|
||||
TextAlign = ContentAlignment.MiddleLeft, Margin = new Padding(0, 6, 8, 0)
|
||||
};
|
||||
if (control.Width <= 0) control.Width = InputWidth;
|
||||
row.Controls.Add(lbl);
|
||||
row.Controls.Add(control);
|
||||
return row;
|
||||
}
|
||||
|
||||
@@ -458,7 +462,9 @@ public sealed class SettingsView : UserControl
|
||||
{
|
||||
var b = new Button
|
||||
{
|
||||
Text = text, Width = 90, Height = 28, FlatStyle = FlatStyle.Flat,
|
||||
Text = text, AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink,
|
||||
MinimumSize = new Size(90, 28), Padding = new Padding(10, 2, 10, 2),
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
ForeColor = Theme.Text, BackColor = Theme.TabBack, Font = Theme.UiFont,
|
||||
Cursor = Cursors.Hand, Margin = new Padding(8, 0, 0, 0)
|
||||
};
|
||||
|
||||
@@ -52,7 +52,8 @@ public sealed class WorkspaceView : UserControl
|
||||
BackColor = Theme.WorkspaceBack;
|
||||
|
||||
// 頂部工具列容器:左側為 Layout/Run 群組(Fill),右側為 Log All(Dock Right)
|
||||
var topBar = new Panel { Dock = DockStyle.Top, Height = 38, BackColor = Theme.RailBack };
|
||||
// 高度 40 與左側 ConnectionSidebar 的 tab bar 對齊,且容得下 AutoSize 按鈕(不被裁切)
|
||||
var topBar = new Panel { Dock = DockStyle.Top, Height = 40, BackColor = Theme.RailBack };
|
||||
|
||||
_toolbar = new FlowLayoutPanel
|
||||
{
|
||||
@@ -374,7 +375,9 @@ public sealed class WorkspaceView : UserControl
|
||||
{
|
||||
var b = new Button
|
||||
{
|
||||
Text = label, AutoSize = false, Size = new Size(44, 26), FlatStyle = FlatStyle.Flat,
|
||||
Text = label, AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink,
|
||||
MinimumSize = new Size(40, 26), Padding = new Padding(8, 2, 8, 2),
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
ForeColor = Theme.Text, BackColor = Theme.TabBack, Font = Theme.UiFont,
|
||||
Margin = new Padding(3, 0, 3, 0), Cursor = Cursors.Hand
|
||||
};
|
||||
@@ -384,11 +387,13 @@ public sealed class WorkspaceView : UserControl
|
||||
return b;
|
||||
}
|
||||
|
||||
private static Button MakeActionButton(string text, int width, int leftMargin, EventHandler onClick)
|
||||
private static Button MakeActionButton(string text, int minWidth, int leftMargin, EventHandler onClick)
|
||||
{
|
||||
var b = new Button
|
||||
{
|
||||
Text = text, AutoSize = false, Size = new Size(width, 26), FlatStyle = FlatStyle.Flat,
|
||||
Text = text, AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink,
|
||||
MinimumSize = new Size(minWidth, 26), Padding = new Padding(10, 2, 10, 2),
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
ForeColor = Theme.Text, BackColor = Theme.TabBack, Font = Theme.UiFont,
|
||||
Margin = new Padding(leftMargin, 0, 3, 0), Cursor = Cursors.Hand
|
||||
};
|
||||
|
||||
@@ -10,10 +10,13 @@
|
||||
<AssemblyName>ETTerms</AssemblyName>
|
||||
|
||||
<!-- 版本資訊 -->
|
||||
<Version>0.2.1</Version>
|
||||
<Version>0.2.2</Version>
|
||||
<Product>ETTerms</Product>
|
||||
<Company>ETTerms Project</Company>
|
||||
|
||||
<!-- 高 DPI:PerMonitorV2,讓不同縮放比例的螢幕都能正確縮放、避免文字/按鈕被裁切 -->
|
||||
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
|
||||
|
||||
<!-- 視窗 / 工作列 / exe 圖示 -->
|
||||
<ApplicationIcon>Assets\Choco_256x256.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
@@ -37,14 +40,17 @@
|
||||
這樣單一 `dotnet publish src\ETTerms` 就會產生完整自洽的 bundle,
|
||||
且 McpRegistrar.ResolveServerExe() 解析的 <ETTerms.exe>\ETTerms.SerialMcp\ETTerms.SerialMcp.exe 必定存在。
|
||||
刻意放子資料夾:與 GUI 的相依 dll 隔離,避免互相覆蓋。
|
||||
MCP 跟隨 GUI 的 self-contained 設定:框架相依版 → MCP 也框架相依;portable(self-contained)版 → MCP 也免 runtime。
|
||||
-->
|
||||
<Target Name="PublishSerialMcp" AfterTargets="Publish">
|
||||
<PropertyGroup>
|
||||
<_McpRid Condition="'$(RuntimeIdentifier)' != ''">$(RuntimeIdentifier)</_McpRid>
|
||||
<_McpRid Condition="'$(RuntimeIdentifier)' == ''">win-x64</_McpRid>
|
||||
<_McpSelfContained Condition="'$(SelfContained)' != ''">$(SelfContained)</_McpSelfContained>
|
||||
<_McpSelfContained Condition="'$(SelfContained)' == ''">false</_McpSelfContained>
|
||||
</PropertyGroup>
|
||||
<Message Importance="high" Text="[ETTerms] Publishing ETTerms.SerialMcp -> $(PublishDir)ETTerms.SerialMcp" />
|
||||
<Exec Command="dotnet publish "$(MSBuildThisFileDirectory)..\ETTerms.SerialMcp\ETTerms.SerialMcp.csproj" -c $(Configuration) -r $(_McpRid) --self-contained false -o "$(PublishDir)ETTerms.SerialMcp"" />
|
||||
<Message Importance="high" Text="[ETTerms] Publishing ETTerms.SerialMcp -> $(PublishDir)ETTerms.SerialMcp (self-contained=$(_McpSelfContained))" />
|
||||
<Exec Command="dotnet publish "$(MSBuildThisFileDirectory)..\ETTerms.SerialMcp\ETTerms.SerialMcp.csproj" -c $(Configuration) -r $(_McpRid) --self-contained $(_McpSelfContained) -o "$(PublishDir)ETTerms.SerialMcp"" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -270,20 +270,29 @@ public sealed class ScreenBuffer
|
||||
{
|
||||
cols = Math.Max(1, cols); rows = Math.Max(1, rows);
|
||||
if (cols == Cols && rows == Rows) return;
|
||||
var ng = new Cell[rows][];
|
||||
for (int r = 0; r < rows; r++)
|
||||
{
|
||||
ng[r] = new Cell[cols];
|
||||
for (int c = 0; c < cols; c++)
|
||||
ng[r][c] = (r < Rows && c < Cols) ? _screen[r][c] : BlankDefault();
|
||||
}
|
||||
_screen = ng;
|
||||
_screen = Reflow(_screen, rows, cols);
|
||||
// alt screen 啟用中也要一併 reflow 保存的主畫面,否則 resize 後 ExitAlt 會還原失敗、
|
||||
// 畫面殘留 TUI 內容。不可把 _mainScreen 丟掉。
|
||||
if (_mainScreen != null) _mainScreen = Reflow(_mainScreen, rows, cols);
|
||||
Rows = rows; Cols = cols;
|
||||
_top = 0; _bottom = Rows - 1;
|
||||
CursorRow = Math.Clamp(CursorRow, 0, Rows - 1);
|
||||
CursorCol = Math.Clamp(CursorCol, 0, Cols - 1);
|
||||
_wrapPending = false;
|
||||
_mainScreen = null;
|
||||
if (AltActive) { /* alt 下 resize:重建 alt 畫面 */ }
|
||||
}
|
||||
|
||||
/// <summary>把字格陣列重排到新尺寸,保留左上重疊區,其餘填預設空白。</summary>
|
||||
private Cell[][] Reflow(Cell[][] src, int rows, int cols)
|
||||
{
|
||||
int oldRows = src.Length;
|
||||
var ng = new Cell[rows][];
|
||||
for (int r = 0; r < rows; r++)
|
||||
{
|
||||
ng[r] = new Cell[cols];
|
||||
int oldCols = r < oldRows ? src[r].Length : 0;
|
||||
for (int c = 0; c < cols; c++)
|
||||
ng[r][c] = (c < oldCols) ? src[r][c] : BlankDefault();
|
||||
}
|
||||
return ng;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,11 @@ public static class TerminalInput
|
||||
{
|
||||
public static byte[]? Map(KeyEventArgs e, bool appCursor)
|
||||
{
|
||||
// Enter:一般送 CR(\r) 視為「送出」;Shift+Enter 送 LF(\n),讓 PSReadLine / Kiro 等
|
||||
// 視為「插入換行」以便輸入多行指令,而不是直接送出。
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
return new[] { (byte)(e.Shift ? '\n' : '\r') };
|
||||
|
||||
string? seq = e.KeyCode switch
|
||||
{
|
||||
Keys.Up => appCursor ? "\x1bOA" : "\x1b[A",
|
||||
@@ -21,7 +26,6 @@ public static class TerminalInput
|
||||
Keys.Delete => "\x1b[3~",
|
||||
Keys.PageUp => "\x1b[5~",
|
||||
Keys.PageDown => "\x1b[6~",
|
||||
Keys.Enter => "\r",
|
||||
Keys.Tab => "\t",
|
||||
Keys.Escape => "\x1b",
|
||||
Keys.Back => "\x7f",
|
||||
|
||||
@@ -59,6 +59,13 @@ public sealed class TerminalView : UserControl
|
||||
protected override void OnSizeChanged(EventArgs e)
|
||||
{
|
||||
base.OnSizeChanged(e);
|
||||
|
||||
// 視窗最小化、或分頁/分割切換的瞬間,ClientSize 會變成 0/極小。此時若把退化尺寸
|
||||
// (會被算成 1×1)送給 PTY,ConPTY 下的全螢幕 TUI(如 Kiro CLI)會誤以為終端機只剩
|
||||
// 1×1 而停止重繪、輸入也像「卡住」。直接忽略這種尺寸,還原後再以正常尺寸重繪即可。
|
||||
if (ClientSize.Width < _cellW || ClientSize.Height < _cellH) return;
|
||||
if (FindForm() is { WindowState: FormWindowState.Minimized }) return;
|
||||
|
||||
int cols = VisibleCols, rows = VisibleRows;
|
||||
if (cols == _lastCols && rows == _lastRows) return;
|
||||
_lastCols = cols; _lastRows = rows;
|
||||
|
||||
Reference in New Issue
Block a user