diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2014-10-31 01:15:50 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2014-10-31 01:15:50 -0700 |
commit | 7ac593273e25d5ce39104dc1752660a43a29f61d (patch) | |
tree | 1f0a18a2f49a61460ff8d7c1c3de375af37395d4 /output.cpp | |
parent | a529fc9d83295fdf9418436b68d056162ba8231b (diff) |
Remove a bunch of dead code identified by cppcheck
Diffstat (limited to 'output.cpp')
-rw-r--r-- | output.cpp | 128 |
1 files changed, 0 insertions, 128 deletions
@@ -527,134 +527,6 @@ void writestr(const wchar_t *str) delete[] buffer; } - -void writestr_ellipsis(const wchar_t *str, int max_width) -{ - int written=0; - int tot; - - CHECK(str,); - - tot = fish_wcswidth(str); - - if (tot <= max_width) - { - writestr(str); - return; - } - - while (*str != 0) - { - int w = fish_wcwidth(*str); - if (written+w+fish_wcwidth(ellipsis_char)>max_width) - { - break; - } - written+=w; - writech(*(str++)); - } - - written += fish_wcwidth(ellipsis_char); - writech(ellipsis_char); - - while (written < max_width) - { - written++; - writestr(L" "); - } -} - -int write_escaped_str(const wchar_t *str, int max_len) -{ - - int i; - int written=0; - - CHECK(str, 0); - - wcstring out = escape(str, ESCAPE_ALL); - int len = fish_wcswidth(out); - - if (max_len && (max_len < len)) - { - for (i=0; (written+fish_wcwidth(out[i]))<=(max_len-1); i++) - { - writech(out[i]); - written += fish_wcwidth(out[i]); - } - writech(ellipsis_char); - written += fish_wcwidth(ellipsis_char); - - for (i=written; i<max_len; i++) - { - writech(L' '); - written++; - } - } - else - { - written = len; - writestr(out.c_str()); - } - - return written; -} - - -int output_color_code(const wcstring &val, bool is_background) -{ - size_t i; - int color=FISH_COLOR_NORMAL; - int is_bold=0; - int is_underline=0; - - if (val.empty()) - return FISH_COLOR_NORMAL; - - wcstring_list_t el; - tokenize_variable_array(val, el); - - for (size_t j=0; j < el.size(); j++) - { - const wcstring &next = el.at(j); - wcstring color_name; - if (is_background) - { - // look for something like "--background=red" - const wcstring prefix = L"--background="; - if (string_prefixes_string(prefix, next)) - { - color_name = wcstring(next, prefix.size()); - } - - } - else - { - if (next == L"--bold" || next == L"-o") - is_bold = true; - else if (next == L"--underline" || next == L"-u") - is_underline = true; - else - color_name = next; - } - - if (! color_name.empty()) - { - for (i=0; i<FISH_COLORS; i++) - { - if (wcscasecmp(col[i], color_name.c_str()) == 0) - { - color = col_idx[i]; - break; - } - } - } - - } - - return color | (is_bold?FISH_COLOR_BOLD:0) | (is_underline?FISH_COLOR_UNDERLINE:0); -} - rgb_color_t parse_color(const wcstring &val, bool is_background) { int is_bold=0; |