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
This commit is contained in:
Frank LENORMAND 2018-12-16 13:39:50 +03:00
parent 3c34de7fe7
commit c744b59f7d

View File

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