1
0
mirror of synced 2025-01-19 01:24:15 +01:00

fix: Find view string filters filtering for some wrong characters (#972)

`\r` and `\n` need to be filtered.
This commit is contained in:
qux-bbb 2023-03-13 18:06:30 +08:00 committed by GitHub
parent d9a498e8ec
commit 9b05a36529
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -259,10 +259,10 @@ namespace hex::plugin::builtin {
(settings.m_lowerCaseLetters && std::islower(byte)) ||
(settings.m_upperCaseLetters && std::isupper(byte)) ||
(settings.m_numbers && std::isdigit(byte)) ||
(settings.m_spaces && std::isspace(byte)) ||
(settings.m_spaces && std::isspace(byte) && byte != '\r' && byte != '\n') ||
(settings.m_underscores && byte == '_') ||
(settings.m_symbols && std::ispunct(byte)) ||
(settings.m_lineFeeds && byte == '\n');
(settings.m_symbols && std::ispunct(byte) && !std::isspace(byte)) ||
(settings.m_lineFeeds && (byte == '\r' || byte == '\n'));
if (settings.type == UTF16LE) {
// Check if second byte of UTF-16 encoded string is 0x00
@ -613,8 +613,8 @@ namespace hex::plugin::builtin {
ImGui::Checkbox(hex::format("{} [0-9]", "hex.builtin.view.find.strings.numbers"_lang.get()).c_str(), &settings.m_numbers);
ImGui::Checkbox(hex::format("{} [_]", "hex.builtin.view.find.strings.underscores"_lang.get()).c_str(), &settings.m_underscores);
ImGui::Checkbox(hex::format("{} [!\"#$%...]", "hex.builtin.view.find.strings.symbols"_lang.get()).c_str(), &settings.m_symbols);
ImGui::Checkbox(hex::format("{} [ ]", "hex.builtin.view.find.strings.spaces"_lang.get()).c_str(), &settings.m_spaces);
ImGui::Checkbox(hex::format("{} [\\n]", "hex.builtin.view.find.strings.line_feeds"_lang.get()).c_str(), &settings.m_lineFeeds);
ImGui::Checkbox(hex::format("{} [ \\f\\t\\v]", "hex.builtin.view.find.strings.spaces"_lang.get()).c_str(), &settings.m_spaces);
ImGui::Checkbox(hex::format("{} [\\r\\n]", "hex.builtin.view.find.strings.line_feeds"_lang.get()).c_str(), &settings.m_lineFeeds);
}
this->m_settingsValid = true;