diff --git a/pageManager.cpp b/pageManager.cpp index 3f25b3d..1cc478a 100644 --- a/pageManager.cpp +++ b/pageManager.cpp @@ -143,7 +143,7 @@ std::string PageManager::checkName(std::string Name) return "-1"; } else { - std::cout << "boku-dake-ga-inai-machi > Name: " << name << std::endl; + std::cout << "\33[2K\r > Name: " << name << std::endl; return name; } } diff --git a/parameterManager.h b/parameterManager.h index 1194c30..7639452 100644 --- a/parameterManager.h +++ b/parameterManager.h @@ -36,7 +36,7 @@ struct Settings { proxy_ip = "127.0.0.1", languages = "GerDub,GerSub,Eng", genaueHoster = "Vivo,GoUnlimited", - version = "2.2.1", + version = "2.2.2", outputFilePath = "", default_checkDirPath = "", default_Searchmuster = "S%Staffel%E%Folge%"; diff --git a/programManager.cpp b/programManager.cpp index ff3ec41..03ac582 100644 --- a/programManager.cpp +++ b/programManager.cpp @@ -370,14 +370,24 @@ int ProgramManager::searchModus(Settings *settings) std::string finds = pageManager.grep(serienListe, settings->name, settings->search_IgnoreUpperLower); serienListe.clear(); // Speicher freigeben - //Text mit Farben versehen + /*//Text mit Farben versehen if(!settings->colorless) { for (size_t pos = pageManager.upper_string( finds ).find( pageManager.upper_string( settings->name ), 0); pos != std::string::npos; pos = pageManager.upper_string( finds ).find( pageManager.upper_string( settings->name ), pos + settings->name.length() + strlen("\033[37m\033[0m"))) finds.insert(pos, ( (finds.find(settings->name, pos) == pos) ? "\033[32m" : "\033[36m" ) ).insert(pos + settings->name.length() + strlen("\033[37m"), "\033[0m"); - } + }*/ + //Text mit Farben versehen + if(!settings->colorless) { + std::string UpperFinds = pageManager.upper_string( finds ); + std::string UpperName = pageManager.upper_string( settings->name ); + for (size_t pos = UpperFinds.find( UpperName, 0); pos != std::string::npos; pos = UpperFinds.find( UpperName, pos + settings->name.length() + strlen("\033[37m\033[0m"))) { + bool exaktGeschrieben = (finds.find(settings->name, pos) == pos); + finds.insert(pos, ( (exaktGeschrieben) ? "\033[32m" : "\033[36m" ) ).insert(pos + settings->name.length() + strlen("\033[37m"), "\033[0m"); + UpperFinds.insert(pos, ( (exaktGeschrieben ) ? "\033[32m" : "\033[36m" ) ).insert(pos + settings->name.length() + strlen("\033[37m"), "\033[0m"); + } + } //Ausgabe if(finds == "") { std::cout << " => Für '" << settings->name << "' wurde(n) keine Serie(n) gefunden." << std::endl;