diff --git a/docs/config/lua/pane/is_alt_screen_active.md b/docs/config/lua/pane/is_alt_screen_active.md new file mode 100644 index 000000000..38513ab9f --- /dev/null +++ b/docs/config/lua/pane/is_alt_screen_active.md @@ -0,0 +1,7 @@ +# `pane:is_alt_screen_active()` + +*Since: nightly builds only* + +Returns whether the alternate screen is active for the pane. + +The alternate screen is a secondary screen that is activated by certain escape codes. The alternate screen has no scrollback, which makes it ideal for a "full-screen" terminal program like `vim` or `less` to do whatever they want on the screen without fear of destroying the user's scrollback. Those programs emit escape codes to return to the normal screen when they exit. diff --git a/wezterm-gui/src/scripting/pane.rs b/wezterm-gui/src/scripting/pane.rs index d13421f91..df3b76d56 100644 --- a/wezterm-gui/src/scripting/pane.rs +++ b/wezterm-gui/src/scripting/pane.rs @@ -63,6 +63,9 @@ impl UserData for PaneObject { methods.add_method("has_unseen_output", |_, this, _: ()| { Ok(this.pane()?.has_unseen_output()) }); + methods.add_method("is_alt_screen_active", |_, this, _: ()| { + Ok(this.pane()?.is_alt_screen_active()) + }); // When called with no arguments, returns the lines from the // viewport as plain text (no escape sequences).