v1.0.20 Bug fixes

This commit is contained in:
aristocratos 2021-10-26 23:41:40 +02:00
parent 36c74fb08a
commit 587005f094
5 changed files with 17 additions and 16 deletions

View file

@ -1,3 +1,13 @@
## v1.0.20
* Added: Improved cpu sensor detection for Ryzen Mobile, by @adnanpri
* Changed: Updated makefile
* Changed: Regex for Fx::uncolor() changed to string search and replace
* Changed: Removed all use of regex with dedicated string functions
## v1.0.19
* Fixed: Makefile now tests compiler flag compatibility

View file

@ -53,7 +53,7 @@ namespace Global {
{"#801414", "██████╔╝ ██║ ╚██████╔╝██║ ╚═╝ ╚═╝"},
{"#000000", "╚═════╝ ╚═╝ ╚═════╝ ╚═╝"},
};
const string Version = "1.0.19";
const string Version = "1.0.20";
int coreCount;
string overlay;

View file

@ -145,12 +145,12 @@ namespace Fx {
for (size_t offset = 0, start_pos = 0, end_pos = 0, next_pos = 0;;) {
if ((start_pos = next_pos > 0 ? next_pos : out.find('\x1b', offset)) == string::npos)
break;
offset = start_pos;
offset = ++start_pos;
if ((end_pos = out.find('m', offset)) == string::npos)
break;
else if (next_pos = out.find('\x1b', offset + 1); end_pos - start_pos > next_pos - start_pos)
else if (next_pos = out.find('\x1b', offset); not isdigit(out[end_pos - 1]) or end_pos - start_pos > next_pos - start_pos)
continue;
out.replace(start_pos, (end_pos - start_pos) + 1, "");
out.replace(start_pos, end_pos - start_pos, "");
next_pos = 0;
}
out.shrink_to_fit();

View file

@ -21,7 +21,6 @@ tab-size = 4
#include <string>
#include <vector>
#include <array>
#include <regex>
#include <atomic>
#include <filesystem>
#include <ranges>
@ -30,7 +29,7 @@ tab-size = 4
#include <tuple>
#include <pthread.h>
using std::string, std::vector, std::atomic, std::to_string, std::regex, std::tuple, std::array;
using std::string, std::vector, std::atomic, std::to_string, std::tuple, std::array;
//? ------------------------------------------------- NAMESPACES ------------------------------------------------------
@ -57,12 +56,6 @@ namespace Fx {
//* Reset text effects and restore theme foregrund and background color
extern string reset;
//* Regex for matching color, style and cursor move escape sequences
const regex escape_regex("\033\\[\\d+;?\\d?;?\\d*;?\\d*;?\\d*(m|f|s|u|C|D|A|B){1}");
//* Regex for matching only color and style escape sequences
const regex color_regex("\033\\[\\d+;?\\d?;?\\d*;?\\d*;?\\d*(m){1}");
//* Return a string with all colors and text styling removed
string uncolor(const string& s);

View file

@ -21,7 +21,6 @@ tab-size = 4
#include <cmath>
#include <unistd.h>
#include <numeric>
#include <regex>
#include <sys/statvfs.h>
#include <netdb.h>
#include <ifaddrs.h>
@ -217,9 +216,8 @@ namespace Cpu {
name += n + ' ';
}
name.pop_back();
for (const auto& reg : {regex("Processor"), regex("CPU"), regex("\\(R\\)"), regex("\\(TM\\)"), regex("Intel"),
regex("AMD"), regex("Core"), regex("\\d?\\.?\\d+[mMgG][hH][zZ]")}) {
name = std::regex_replace(name, reg, "");
for (const auto& replace : {"Processor", "CPU", "(R)", "(TM)", "Intel", "AMD", "Core"}) {
name = s_replace(name, replace, "");
}
name = trim(name);
}