Update KeyPressed reference in imgui_memory_editor
This commit is contained in:
@@ -253,13 +253,23 @@ struct MemoryEditor
|
||||
size_t preview_data_type_size = OptShowDataPreview ? DataTypeGetSize(PreviewDataType) : 0;
|
||||
|
||||
size_t data_editing_addr_next = (size_t)-1;
|
||||
if (DataEditingAddr != (size_t)-1)
|
||||
{
|
||||
// Move cursor but only apply on next frame so scrolling with be synchronized (because currently we can't change the scrolling while the window is being rendered)
|
||||
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow)) && (ptrdiff_t)DataEditingAddr >= (ptrdiff_t)Cols) { data_editing_addr_next = DataEditingAddr - Cols; }
|
||||
else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow)) && (ptrdiff_t)DataEditingAddr < (ptrdiff_t)mem_size - Cols) { data_editing_addr_next = DataEditingAddr + Cols; }
|
||||
else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_LeftArrow)) && (ptrdiff_t)DataEditingAddr > (ptrdiff_t)0) { data_editing_addr_next = DataEditingAddr - 1; }
|
||||
else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_RightArrow)) && (ptrdiff_t)DataEditingAddr < (ptrdiff_t)mem_size - 1) { data_editing_addr_next = DataEditingAddr + 1; }
|
||||
if (DataEditingAddr != (size_t)-1) {
|
||||
// Move cursor but only apply on next frame so scrolling with be
|
||||
// synchronized (because currently we can't change the scrolling while the
|
||||
// window is being rendered)
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_UpArrow) &&
|
||||
(ptrdiff_t)DataEditingAddr >= (ptrdiff_t)Cols) {
|
||||
data_editing_addr_next = DataEditingAddr - Cols;
|
||||
} else if (ImGui::IsKeyPressed(ImGuiKey_DownArrow) &&
|
||||
(ptrdiff_t)DataEditingAddr < (ptrdiff_t)mem_size - Cols) {
|
||||
data_editing_addr_next = DataEditingAddr + Cols;
|
||||
} else if (ImGui::IsKeyPressed(ImGuiKey_LeftArrow) &&
|
||||
(ptrdiff_t)DataEditingAddr > (ptrdiff_t)0) {
|
||||
data_editing_addr_next = DataEditingAddr - 1;
|
||||
} else if (ImGui::IsKeyPressed(ImGuiKey_RightArrow) &&
|
||||
(ptrdiff_t)DataEditingAddr < (ptrdiff_t)mem_size - 1) {
|
||||
data_editing_addr_next = DataEditingAddr + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw vertical separator
|
||||
|
||||
Reference in New Issue
Block a user