debugger: Fix trailing spaces in PPU register dump

This commit is contained in:
Eladash 2023-06-06 09:11:32 +03:00 committed by Megamouse
parent 3f44ecb77a
commit d5eebd6ab4
3 changed files with 11 additions and 3 deletions

View File

@ -589,7 +589,7 @@ std::vector<std::string> fmt::split(std::string_view source, std::initializer_li
return result;
}
std::string fmt::trim(const std::string& source, const std::string& values)
std::string fmt::trim(const std::string& source, std::string_view values)
{
usz begin = source.find_first_not_of(values);
@ -599,6 +599,12 @@ std::string fmt::trim(const std::string& source, const std::string& values)
return source.substr(begin, source.find_last_not_of(values) + 1);
}
void fmt::trim_back(std::string& source, std::string_view values)
{
const usz index = source.find_last_not_of(values);
source.resize(index + 1);
}
std::string fmt::to_upper(std::string_view string)
{
std::string result;

View File

@ -124,7 +124,8 @@ namespace fmt
}
std::vector<std::string> split(std::string_view source, std::initializer_list<std::string_view> separators, bool is_skip_empty = true);
std::string trim(const std::string& source, const std::string& values = " \t");
std::string trim(const std::string& source, std::string_view values = " \t");
void trim_back(std::string& source, std::string_view values = " \t");
template <typename T>
std::string merge(const T& source, const std::string& separator)

View File

@ -1153,7 +1153,8 @@ void ppu_thread::dump_regs(std::string& ret) const
}
}
fmt::append(ret, "\n");
fmt::trim_back(ret);
ret += '\n';
}
for (uint i = 0; i < 32; ++i)