diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-04-18 14:28:53 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-04-18 14:28:53 +0200 |
| commit | 5b61672948bb4db23f386d282f15e240b00ecdf4 (patch) | |
| tree | e2946f0a36190544b3dcc8e5d63665c6ed3ef588 /src | |
| parent | 9a361e2657ca908adc7580073ddf21961f1be967 (diff) | |
add window_{width,height} env var
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.cc b/src/main.cc index 79245fc8..7696ab69 100644 --- a/src/main.cc +++ b/src/main.cc @@ -19,6 +19,7 @@ #include "remote.hh" #include "shell_manager.hh" #include "string.hh" +#include "window.hh" #if defined(__APPLE__) #include <mach-o/dyld.h> @@ -98,6 +99,12 @@ void register_env_vars() { auto& sel = context.editor().main_selection(); auto beg = sel.begin(); return int_to_str((int)beg.line() + 1) + ':' + int_to_str((int)beg.column() + 1) + '+' + int_to_str((int)(sel.end() - beg)); }); + shell_manager.register_env_var("window_width", + [](const String& name, const Context& context) + { return int_to_str((int)context.window().dimensions().column); }); + shell_manager.register_env_var("window_height", + [](const String& name, const Context& context) + { return int_to_str((int)context.window().dimensions().line); }); } void register_registers() |
