diff --git a/src/main.cc b/src/main.cc index db0fb5f46..7752bc665 100644 --- a/src/main.cc +++ b/src/main.cc @@ -385,7 +385,7 @@ static const EnvVarDesc builtin_env_vars[] = { { "window_range", false, [](StringView name, const Context& context) -> Vector { - auto setup = context.window().compute_display_setup(context); + const auto& setup = context.window().last_display_setup(); return {format("{} {} {} {}", setup.first_line, setup.first_column, setup.line_count, 0)}; } diff --git a/src/window.cc b/src/window.cc index b660bbdb9..41e347672 100644 --- a/src/window.cc +++ b/src/window.cc @@ -155,6 +155,7 @@ const DisplayBuffer& Window::update_display_buffer(const Context& context) set_position({setup.first_line, setup.first_column}); m_last_setup = build_setup(context); + m_last_display_setup = setup; return m_display_buffer; } diff --git a/src/window.hh b/src/window.hh index 2b96cb704..65253c87f 100644 --- a/src/window.hh +++ b/src/window.hh @@ -49,10 +49,12 @@ public: void clear_display_buffer(); void run_resize_hook_ifn(); - DisplaySetup compute_display_setup(const Context& context) const; + const DisplaySetup& last_display_setup() const { return m_last_display_setup; } + private: Window(const Window&) = delete; + DisplaySetup compute_display_setup(const Context& context) const; void on_option_changed(const Option& option) override; friend class ClientManager; @@ -68,6 +70,7 @@ private: Highlighters m_builtin_highlighters; bool m_resize_hook_pending = false; + DisplaySetup m_last_display_setup; struct Setup {