1
0
mirror of synced 2025-01-18 17:14:13 +01:00

fix: Trailing zero at end of string input buffers

This commit is contained in:
WerWolv 2022-03-03 09:27:27 +01:00
parent 483ba95d80
commit 39da62532b
2 changed files with 1 additions and 13 deletions

View File

@ -559,16 +559,10 @@ namespace ImGui {
}
bool InputText(const char *label, std::string &buffer, ImGuiInputTextFlags flags) {
if (buffer.empty())
buffer.resize(1, 0x00);
return ImGui::InputText(label, buffer.data(), buffer.size(), ImGuiInputTextFlags_CallbackResize | flags, ImGui::UpdateStringSizeCallback, &buffer);
}
bool InputTextMultiline(const char *label, std::string &buffer, const ImVec2 &size, ImGuiInputTextFlags flags) {
if (buffer.empty())
buffer.resize(1, 0x00);
return ImGui::InputTextMultiline(label, buffer.data(), buffer.size(), size, ImGuiInputTextFlags_CallbackResize | flags, ImGui::UpdateStringSizeCallback, &buffer);
}

View File

@ -131,13 +131,7 @@ namespace hex::plugin::builtin {
void drawMathEvaluator() {
static std::vector<long double> mathHistory;
static std::string lastMathError;
static auto mathInput = [] {
std::string s;
s.reserve(0xFFFF);
std::memset(s.data(), 0x00, s.capacity());
return s;
}();
static std::string mathInput;
bool evaluate = false;
static MathEvaluator mathEvaluator = [&] {