feat(ui): 界面体验一轮打磨(快捷键/暂停滚动/会话恢复/JSON 预览)

- 全局 Ctrl+Enter 发送;订阅框 Enter 提交、Esc 退出编辑;过滤框 Esc 清空
- 消息流新增「暂停/恢复」:暂停时画面不随新消息跳动,消息仍入环形缓冲
- JSON 负载折叠态预览按原始数据美化展示(多行缩进,超 40 行兜底截断)
- 标签页持久化(ui-state.json),重启恢复工作区;无可恢复标签时自动打开
  首个自连连接的工作区,避免「已连上却演空态」
- 侧边栏 Error 连接行内红字显示失败原因;侧边栏/订阅面板补竖分隔线
- 消息订阅色条上下留隙,不再连成一整条竖线
- 发布被当前过滤条件隐藏时给出「已发送」提示
- 连接表单:主机+端口同行;TLS 证书三个路径字段加「浏览…」(rfd)
- 主题切换/系统外观变化后强制整窗重绘,修未收敛区域的旧色残影
- 设置主题文案改「跟随系统」(跟随逻辑此前已实现)
This commit is contained in:
2026-09-30 16:15:58 +08:00
parent f5cd0cdc4f
commit 967bf9dd78
15 changed files with 407 additions and 51 deletions
+33 -1
View File
@@ -340,7 +340,36 @@ pub(super) fn render_subscribe_bar(&mut self, cx: &mut Context<Self>) -> impl In
.child(format!("正在编辑:{topic}")),
)
})
.child(div().flex_1().min_w(px(0.)).child(Input::new(&sub_topic).small()))
.child(
div()
.id(SharedString::from(format!("sub-topic-wrap-{}", self.conn_id)))
.flex_1()
.min_w(px(0.))
// Enter 直接提交订阅;Esc 退出编辑态或清空输入,
// 调试时不必为每次订阅伸手点按钮
.on_key_down(cx.listener(
|this, ev: &gpui_kit::KeyDownEvent, window, cx| {
if ev.keystroke.key == "enter"
&& !ev.keystroke.modifiers.control
&& !ev.keystroke.modifiers.alt
{
cx.stop_propagation();
this.do_subscribe(window, cx);
} else if ev.keystroke.key == "escape" {
cx.stop_propagation();
if this.editing.is_some() {
this.editing = None;
this.reset_subscribe_form(window, cx);
} else {
this.sub_topic
.update(cx, |s, cx| s.set_value("", window, cx));
}
cx.notify();
}
},
))
.child(Input::new(&sub_topic).small()),
)
.child(div().w(px(96.)).child(Select::new(&sub_qos).small()))
.child(div().w(px(112.)).child(Input::new(&sub_alias).small()))
.when(is_v5, |h| {
@@ -706,6 +735,9 @@ pub(super) fn render_subscriptions(&self, cx: &mut Context<Self>) -> impl IntoEl
.h_full()
.bg(cx.theme().sidebar)
.text_color(cx.theme().sidebar_foreground)
// 深色主题下订阅面板与消息区同色,补一条分隔线保持边界可辨
.border_r_1()
.border_color(cx.theme().border)
.child(
h_flex()
.h_11()