all repos — mgba @ 4cb3dad3c3e1dc3987923c68ffb030e76b1aa972

mGBA Game Boy Advance Emulator

Qt: Memory view selection boundary fixes
Jeffrey Pfau jeffrey@endrift.com
Sat, 13 Jun 2015 22:13:21 -0700
commit

4cb3dad3c3e1dc3987923c68ffb030e76b1aa972

parent

edb91143d059c081ff1144f6c5559e1d05c29e34

1 files changed, 5 insertions(+), 5 deletions(-)

jump to
M src/platform/qt/MemoryModel.cppsrc/platform/qt/MemoryModel.cpp

@@ -362,7 +362,7 @@ if (shift) {

if (m_selectionAnchor == m_selection.first) { if (adjust < 0 && m_base - adjust > m_selection.second) { adjust = m_base - m_selection.second + m_align; - } else if (adjust > 0 && m_selection.second + adjust > m_base + m_size) { + } else if (adjust > 0 && m_selection.second + adjust >= m_base + m_size) { adjust = m_base + m_size - m_selection.second; } adjust += m_selection.second;

@@ -372,19 +372,19 @@ m_selection.first = adjust - m_align;

cursorPosition = m_selection.first; } else { m_selection.second = adjust; - cursorPosition = m_selection.second; + cursorPosition = m_selection.second - m_align; } } else { if (adjust < 0 && m_base - adjust > m_selection.first) { adjust = m_base - m_selection.first; - } else if (adjust > 0 && m_selection.first + adjust > m_base + m_size) { + } else if (adjust > 0 && m_selection.first + adjust >= m_base + m_size) { adjust = m_base + m_size - m_selection.first - m_align; } adjust += m_selection.first; if (adjust >= m_selection.second) { m_selection.first = m_selection.second - m_align; m_selection.second = adjust + m_align; - cursorPosition = m_selection.second; + cursorPosition = adjust; } else { m_selection.first = adjust; cursorPosition = m_selection.first;

@@ -399,7 +399,7 @@ m_selectionAnchor = m_selection.first;

} if (adjust < 0 && m_base - adjust > m_selectionAnchor) { m_selectionAnchor = m_base; - } else if (adjust > 0 && m_selectionAnchor + adjust > m_base + m_size) { + } else if (adjust > 0 && m_selectionAnchor + adjust >= m_base + m_size) { m_selectionAnchor = m_base + m_size - m_align; } else { m_selectionAnchor += adjust;