diff options
| author | Frank LENORMAND <lenormf@gmail.com> | 2018-12-16 13:39:50 +0300 |
|---|---|---|
| committer | Frank LENORMAND <lenormf@gmail.com> | 2019-10-20 21:35:50 +0200 |
| commit | c744b59f7d14e735391acf8395fc8d1be28d6ed5 (patch) | |
| tree | dd443f7371cd83a4b59e9d6f6a14993bf37c8881 /src | |
| parent | 3c34de7fe7db607fe2c0519471b8d3c4935ce717 (diff) | |
src: Add a `window_range` default expansion
This commit adds a `window_range` default expansion that holds the
coordinates and size of the buffer-space on the window.
Fixes #675
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main.cc b/src/main.cc index 5cc39286..9c3b4287 100644 --- a/src/main.cc +++ b/src/main.cc @@ -280,6 +280,17 @@ static const EnvVarDesc builtin_env_vars[] = { { "user_modes", false, [](StringView name, const Context& context, Quoting quoting) -> String { return join(context.keymaps().user_modes(), ' ', false); } + }, { + "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); + } } }; |
