mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-26 21:22:00 +03:00
Fix window_range expansion
It relied on the buffer first char being visible, and could trigger segfaults when that was not the case.
This commit is contained in:
parent
efabe28173
commit
878a7fbb90
@ -305,12 +305,9 @@ static const EnvVarDesc builtin_env_vars[] = { {
|
|||||||
"window_range", false,
|
"window_range", false,
|
||||||
[](StringView name, const Context& context, Quoting quoting) -> String
|
[](StringView name, const Context& context, Quoting quoting) -> String
|
||||||
{
|
{
|
||||||
const auto top_left = context.window().display_position({0, 0});
|
auto setup = context.window().compute_display_setup(context);
|
||||||
const auto window_dim = context.window().dimensions();
|
return format("{} {} {} {}", setup.window_pos.line, setup.window_pos.column,
|
||||||
|
setup.window_range.line, setup.window_range.column);
|
||||||
return format("{} {} {} {}", top_left->line, top_left->column,
|
|
||||||
window_dim.line - top_left->line,
|
|
||||||
window_dim.column - top_left->column);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -50,11 +50,11 @@ public:
|
|||||||
void clear_display_buffer();
|
void clear_display_buffer();
|
||||||
void run_resize_hook_ifn();
|
void run_resize_hook_ifn();
|
||||||
|
|
||||||
|
DisplaySetup compute_display_setup(const Context& context) const;
|
||||||
private:
|
private:
|
||||||
Window(const Window&) = delete;
|
Window(const Window&) = delete;
|
||||||
|
|
||||||
void on_option_changed(const Option& option) override;
|
void on_option_changed(const Option& option) override;
|
||||||
DisplaySetup compute_display_setup(const Context& context) const;
|
|
||||||
|
|
||||||
friend class ClientManager;
|
friend class ClientManager;
|
||||||
void run_hook_in_own_context(Hook hook, StringView param,
|
void run_hook_in_own_context(Hook hook, StringView param,
|
||||||
|
Loading…
Reference in New Issue
Block a user