Skip to content

Commit 9787756

Browse files
committed
Use last display setup instead of recomputing for window_range
Fixes #4964
1 parent 9b1f4f5 commit 9787756

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ static const EnvVarDesc builtin_env_vars[] = { {
385385
"window_range", false,
386386
[](StringView name, const Context& context) -> Vector<String>
387387
{
388-
auto setup = context.window().compute_display_setup(context);
388+
const auto& setup = context.window().last_display_setup();
389389
return {format("{} {} {} {}", setup.first_line, setup.first_column,
390390
setup.line_count, 0)};
391391
}

src/window.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ const DisplayBuffer& Window::update_display_buffer(const Context& context)
155155

156156
set_position({setup.first_line, setup.first_column});
157157
m_last_setup = build_setup(context);
158+
m_last_display_setup = setup;
158159

159160
return m_display_buffer;
160161
}

src/window.hh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ public:
4949
void clear_display_buffer();
5050
void run_resize_hook_ifn();
5151

52-
DisplaySetup compute_display_setup(const Context& context) const;
52+
const DisplaySetup& last_display_setup() const { return m_last_display_setup; }
53+
5354
private:
5455
Window(const Window&) = delete;
5556

57+
DisplaySetup compute_display_setup(const Context& context) const;
5658
void on_option_changed(const Option& option) override;
5759

5860
friend class ClientManager;
@@ -68,6 +70,7 @@ private:
6870

6971
Highlighters m_builtin_highlighters;
7072
bool m_resize_hook_pending = false;
73+
DisplaySetup m_last_display_setup;
7174

7275
struct Setup
7376
{

0 commit comments

Comments
 (0)