4. Terminal: Catch change directory signal in node pty, rename terminal buffer and change Emacs default directory variable real time - HollowMan6/EAF-OSPP-Summer-2020 GitHub Wiki

相关issue: #4

相关PR: #325#329#331#351

我发现当更改目录时,服务器将向前端发送消息。这是将目录更改为~时发送的消息的示例:

]0;hollowman@hollow-manjaro:~[hollowman@hollow-manjaro ~]$

因此,当信号发生时,我使用正则表达式/:([^\x07].*?)\x07/g提取目录信息并将其存储在变量中:

]0;hollowman@hollow-manjaro: ~ [hollowman@hollow-manjaro ~]$

因而,AppBuffer(Buffer.py)每250毫秒检查一次title变量,如果它检测到任何变化,则on_change_directory方法将设置标题和Emacs的默认目录。

随后修复以下BUG:

[EAF] Killed 54ab-347e-492b-c905-3201-aa3d-fdbc.
[EAF] Killed 0aec-a9cf-9048-13f3-8de6-132f-c8e0.
[EAF] Killed 2 EAF buffers
[EAF] eaf 已杀死
[EAF] Process terminated.
apply: Setting current directory: 没有那个文件或目录, None
Mark set [2 times]
Error running timer: (file-missing "Setting current directory" "没有那个文件或目录" "None") [2 times]

最后对于附加任务,添加对重命名ssh下的终端缓冲区的支持,下面提供了ssh下的终端缓冲区名称示例: [email protected]:~/

添加对运行程序时重命名终端缓冲区的支持,下面提供了运行程序时终端缓冲区名称的示例: test- ~/

但是,最终因为系统适配问题,虽然此方法在我的环境中运行无问题,但是在一些系统上运行会出问题,因而未能合并进入上游,最终运行程序时重命名终端缓冲区合并进入上游,ssh问题正在解决。