From 5b61672948bb4db23f386d282f15e240b00ecdf4 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 18 Apr 2013 14:28:53 +0200 Subject: [PATCH] add window_{width,height} env var --- src/main.cc | 7 +++++++ 1 file changed, 7 insertions(+) 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 @@ -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()