Repository navigation
fix(term): post a command's end only after it ran 2 s - #11
Merged
Raiden-MeixElysia merged 1 commit intoOct 22, 2026
Merged
Conversation
A program may write OSC 133 marks of its own: omp 18.12.5 wraps every message it renders in A, B, C and D, so each message read as a command that ended, and a session in the background posted "Command finished" every 3 s while an agent worked (ELY-Open-Source#10). Record the moment C came; only a command that ran RAN_FOR, 2 s, posts its end. The marks of a message come and go in a breath, so they stay quiet, as does a command that ends within the two seconds.
Contributor
|
感谢 PR!已合并,阈值按 Ghostty 的默认改为 5 秒,随 v0.1.8 发布。https://github.com/ELY-Open-Source/ELYTerminal/releases/tag/v0.1.8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10
根因
omp 18.12.5 会给每条渲染的消息包一层 shell 集成标记:
ESC]133;A BEL(首行)、ESC]133;B BEL ESC]133;C BEL ESC]133;D;0 BEL(末行,含清空)。pty 捕获一个回合的完整序列:ELYTerminal 的 tap 读取任何程序的 OSC 133(与 Ghostty 一致,见 T40)。于是 omp 的每条消息都被读成一次完整的命令生命周期:
Mark::Output(C)置ran = true;Mark::Done(D;0)→finished():ran为真且窗口非激活 → post "Command finished"。omp 持续流式渲染消息,通知以 3s 限频(
GAP)连发。标题转圈与它无关(改纯文字无效);其他终端同样解析 133 但不为 D 发通知,故不复现。修复
ran: bool→ran: Option<Instant>,C 时记下时刻;finished()仅在 C→D 间隔 ≥RAN_FOR(2s)时 post。omp 的消息标记瞬时完成,永远过不了阈值;真实 shell 命令跑满 2s 才通知。取舍:
ls等瞬时命令不再触发完成通知。参见 #10 下的讨论:瞬时命令本就无需通知,Ghostty/iTerm2 也只对长时间运行的命令提醒。验证
cargo test --lib term::reports:9 通过(含新增边界测试a_command_ran_short_of_ran_for_posts_nothing:0s、差 1ns、恰好 2s 三点)。sleep 3切后台正常弹一条。