fix: Some cell visualizer types not updating their values correctly

This commit is contained in:
WerWolv
2025-07-26 11:58:30 +02:00
parent 94527345b9
commit be6a90675b
2 changed files with 8 additions and 5 deletions

View File

@@ -1183,10 +1183,10 @@ namespace hex {
}; };
UserData userData = { UserData userData = {
.data = &data, .data = &data,
.maxChars = this->getMaxCharsPerCell(), .maxChars = this->getMaxCharsPerCell(),
.editingDone = false .editingDone = false
}; };
ImGui::PushID(reinterpret_cast<void*>(address)); ImGui::PushID(reinterpret_cast<void*>(address));
@@ -1198,6 +1198,8 @@ namespace hex {
if (data->BufTextLen >= userData.maxChars) if (data->BufTextLen >= userData.maxChars)
userData.editingDone = true; userData.editingDone = true;
data->Buf[userData.maxChars] = 0x00;
return 0; return 0;
}, &userData); }, &userData);
ImGui::PopID(); ImGui::PopID();

View File

@@ -381,6 +381,8 @@ namespace hex::ui {
default: default:
break; break;
} }
m_enteredEditingMode = false;
} }
m_editingBytes = buffer; m_editingBytes = buffer;
@@ -419,6 +421,7 @@ namespace hex::ui {
m_editingAddress = std::nullopt; m_editingAddress = std::nullopt;
else { else {
m_editingAddress = nextEditingAddress; m_editingAddress = nextEditingAddress;
m_enteredEditingMode = true;
if (m_mode == Mode::Insert) { if (m_mode == Mode::Insert) {
std::memset(m_editingBytes.data(), 0x00, size); std::memset(m_editingBytes.data(), 0x00, size);
@@ -449,8 +452,6 @@ namespace hex::ui {
if (!m_editingAddress.has_value()) if (!m_editingAddress.has_value())
m_editingCellType = CellType::None; m_editingCellType = CellType::None;
m_enteredEditingMode = false;
} }
} }