【发布时间】:2011-05-29 16:57:00
【问题描述】:
VIM(运行时)如何将文件的内容显示到终端,然后(关闭时)可以取回显示的内容?我已经制作了几个应用程序,我希望在这些应用程序中实现此功能……例如,在制作带有终端图形的程序时,通常必须在单个“对象”移动时更新整个屏幕。
【问题讨论】:
VIM(运行时)如何将文件的内容显示到终端,然后(关闭时)可以取回显示的内容?我已经制作了几个应用程序,我希望在这些应用程序中实现此功能……例如,在制作带有终端图形的程序时,通常必须在单个“对象”移动时更新整个屏幕。
【问题讨论】:
存储旧缓冲区的是您的终端,而不是 Vim。
如果您使用 XTerm 仿真,Vim 会在启动时切换到“备用”终端屏幕。退出时,Vim 切换回正常屏幕。
启动时的Terminfo字符串:
\E7 saves the cursor's position
\E[?47h switches to the alternate screen
退出时的Terminfo字符串:
\E[2J clears the screen (assumed to be the alternate screen)
\E[?47l switches back to the normal screen
\E8 restores the cursor's position.
【讨论】: