1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-29 10:02:57 +03:00

Use last display setup instead of recomputing for window_range

Fixes #4964
This commit is contained in:
Maxime Coste 2023-09-08 05:24:11 +10:00
parent 9b1f4f5f20
commit 9787756619
3 changed files with 6 additions and 2 deletions

View File

@ -385,7 +385,7 @@ static const EnvVarDesc builtin_env_vars[] = { {
"window_range", false,
[](StringView name, const Context& context) -> Vector<String>
{
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)};
}

View File

@ -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;
}

View File

@ -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
{