From b51376f255ae9ca552224f4d9898101ae4d20987 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Sat, 20 Aug 2016 12:36:53 +0900 Subject: [PATCH] rage browser - nuke silly chars from labels --- src/bin/browser.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/bin/browser.c b/src/bin/browser.c index b2df3f2..99a6025 100644 --- a/src/bin/browser.c +++ b/src/bin/browser.c @@ -274,8 +274,24 @@ _entry_files_pop(Evas_Object *win, Entry *entry) else elm_layout_signal_emit(base, "state,normal", "rage"); snprintf(buf, sizeof(buf), "%s", file); - p = strrchr(buf, '.'); - if (p) *p = 0; + for (p = buf; *p; p++) + { + // nuke stupid characters from the label that may be in filename + if ((*p == '_') || (*p == '#') || (*p == '$') || (*p == '%') || + (*p == '*') || (*p == '+') || (*p == '[') || (*p == ']') || + (*p == ';') || (*p == '<') || (*p == '=') || (*p == '>') || + (*p == '^') || (*p == '`') || (*p == '{') || (*p == '}') || + (*p == '|') || (*p == '~') || (*p == 127) || + (*p == '\'') || (*p == '\\')) + { + *p = ' '; + } + else if (*p == '.') + { + *p = 0; + break; + } + } elm_object_part_text_set(o, "rage.title", buf); evas_object_size_hint_weight_set(o, 0.0, 0.0); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);