diff options
author | Peter Ammon <corydoras@ridiculousfish.com> | 2012-01-14 02:42:17 -0800 |
---|---|---|
committer | Peter Ammon <corydoras@ridiculousfish.com> | 2012-01-14 02:42:17 -0800 |
commit | a359f45df219e6a3845870ca69b4116083d787f7 (patch) | |
tree | 08454add430170b4113659caf084f9a8801f77c3 /kill.cpp | |
parent | e8b6d48ad038089e37730990212676e50a8d2352 (diff) |
Redesign new environment variables to use env_var_t instead of wcstring
Migrate uses of empty() to missing() to distinguish between empty variable and unset variable
Diffstat (limited to 'kill.cpp')
-rw-r--r-- | kill.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
@@ -105,9 +105,8 @@ void kill_add( wchar_t *str ) command too, so, the command used must accept the input via stdin. */ - const wcstring clipboard_wstr = env_get_string(L"FISH_CLIPBOARD_CMD"); -// const wchar_t *clipboard = clipboard_wstr.empty()?NULL:clipboard.c_str(); - if( !clipboard_wstr.empty() ) + const env_var_t clipboard_wstr = env_get_string(L"FISH_CLIPBOARD_CMD"); + if( !clipboard_wstr.missing() ) { escaped_str = escape( str, 1 ); cmd = wcsdupcat(L"echo -n ", escaped_str, clipboard_wstr.c_str()); @@ -119,9 +118,8 @@ void kill_add( wchar_t *str ) return; } - const wcstring disp_wstr = env_get_string( L"DISPLAY" ); -// wchar_t *disp = disp_wstr.empty()?NULL:disp_wstr.c_str(); - if( !disp_wstr.empty() ) + const env_var_t disp_wstr = env_get_string( L"DISPLAY" ); + if( !disp_wstr.missing() ) { escaped_str = escape( str, 1 ); cmd = wcsdupcat(L"echo ", escaped_str, L"|xsel -b" ); @@ -217,14 +215,12 @@ wchar_t *kill_yank_rotate() clipboard contents to the fish killring. */ static void kill_check_x_buffer() -{ - wcstring disp; - +{ if( !has_xsel() ) return; - - if( (!(disp = env_get_string( L"DISPLAY" )).empty()) ) + const env_var_t disp = env_get_string(L"DISPLAY"); + if( ! disp.missing()) { size_t i; wcstring cmd = L"xsel -t 500 -b"; |