diff options
| author | Maxime Coste <mawww@kakoune.org> | 2019-12-16 14:09:20 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2019-12-16 14:09:20 +1100 |
| commit | 878a7fbb903ba9de4e8c75ef007d350f2c36738f (patch) | |
| tree | c656e6c8c51e928fead1d0c4f6c5921470c4b235 /src | |
| parent | efabe281732fa4a2cb83ab2adf65c840c251101f (diff) | |
Fix window_range expansion
It relied on the buffer first char being visible, and could trigger
segfaults when that was not the case.
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cc | 9 | ||||
| -rw-r--r-- | src/window.hh | 2 |
2 files changed, 4 insertions, 7 deletions
diff --git a/src/main.cc b/src/main.cc index 16b4a1a9..84c88012 100644 --- a/src/main.cc +++ b/src/main.cc @@ -305,12 +305,9 @@ static const EnvVarDesc builtin_env_vars[] = { { "window_range", false, [](StringView name, const Context& context, Quoting quoting) -> String { - const auto top_left = context.window().display_position({0, 0}); - const auto window_dim = context.window().dimensions(); - - return format("{} {} {} {}", top_left->line, top_left->column, - window_dim.line - top_left->line, - window_dim.column - top_left->column); + auto setup = context.window().compute_display_setup(context); + return format("{} {} {} {}", setup.window_pos.line, setup.window_pos.column, + setup.window_range.line, setup.window_range.column); } } }; diff --git a/src/window.hh b/src/window.hh index ad754568..dd7a325b 100644 --- a/src/window.hh +++ b/src/window.hh @@ -50,11 +50,11 @@ public: void clear_display_buffer(); void run_resize_hook_ifn(); + DisplaySetup compute_display_setup(const Context& context) const; private: Window(const Window&) = delete; void on_option_changed(const Option& option) override; - DisplaySetup compute_display_setup(const Context& context) const; friend class ClientManager; void run_hook_in_own_context(Hook hook, StringView param, |
