0%

Introduction to the Alternate Screen

While implementing terminal search highlights with xterm.js, it’s essential to determine if the terminal is currently in vi editor mode. Research indicates that xterm.buffer.active.type can be utilized for this purpose.

Upon examining the corresponding type definitions, only two values, normal and alternate, are found. The origin of the term “alternate” led to further investigation, revealing its roots in the terminal’s alternate screen concept. This article aims to provide a comprehensive overview.

Alternate Screen Image

Alternate Screen - A Backup Screen

  1. This translation adheres to Apple’s terminology, referring to xshell as the terminal replacement screen.
  2. The alternate screen serves as a temporary interactive input screen, which must eventually revert back. For instance, in VI mode, although the screen’s display area remains unchanged, activating the alternate screen saves the original screen content, which is restored upon exiting.
  3. Hence, the concept of normal/alternate in xterm is not original but rather a fundamental design of the terminal, encompassing both normal and backup modes.

Conclusion

xterm.js represents just one implementation of xterm. To fully grasp xterm.js, it’s beneficial to explore various designs of the xterm terminal emulator.