1
0
Fork 0

GUI: fixed bugs with the selection of items bigger than 1 byte

This commit is contained in:
Mr. eXoDia 2014-06-24 16:24:48 +02:00
parent 38c3399fe4
commit f7eed3d426
2 changed files with 33 additions and 11 deletions

View File

@ -504,13 +504,13 @@ void Disassembly::mousePressEvent(QMouseEvent* event)
else if(event->y() > getHeaderHeight())
{
int_t wRowIndex = getInstructionRVA(getTableOffset(), getIndexOffsetFromY(transY(event->y())));
int_t wInstrSize = getInstructionRVA(wRowIndex, 1) - wRowIndex - 1;
if(wRowIndex < getRowCount())
{
if(event->modifiers() & Qt::ShiftModifier) //SHIFT pressed
expandSelectionUpTo(wRowIndex);
else
if(!(event->modifiers() & Qt::ShiftModifier)) //SHIFT pressed
setSingleSelection(wRowIndex);
expandSelectionUpTo(wRowIndex+wInstrSize);
mGuiState = Disassembly::MultiRowsSelectionState;
@ -1060,16 +1060,24 @@ void Disassembly::selectNext(bool expand)
int_t wAddr;
if(expand)
{
if(getSelectionEnd()==getInitialSelection()) //decrease down
if(getSelectionEnd()==getInitialSelection() && getSelectionStart()!=getSelectionEnd()) //decrease down
{
wAddr = getInstructionRVA(getSelectionStart(), 1);
expandSelectionUpTo(wAddr);
}
else //expand down
wAddr = getInstructionRVA(getSelectionEnd(), 1);
expandSelectionUpTo(wAddr);
{
wAddr = getSelectionEnd() + 1;
int_t wInstrSize = getInstructionRVA(wAddr, 1) - wAddr - 1;
expandSelectionUpTo(wAddr + wInstrSize);
}
}
else
{
wAddr = getInstructionRVA(getSelectionEnd(), 1);
wAddr = getSelectionEnd() + 1;
setSingleSelection(wAddr);
int_t wInstrSize = getInstructionRVA(wAddr, 1) - wAddr - 1;
expandSelectionUpTo(wAddr + wInstrSize);
}
}
@ -1079,16 +1087,24 @@ void Disassembly::selectPrevious(bool expand)
int_t wAddr;
if(expand)
{
if(getSelectionStart()==getInitialSelection()) //decrease down
wAddr = getInstructionRVA(getSelectionEnd(), -1);
if(getSelectionStart()==getInitialSelection() && getSelectionStart()!=getSelectionEnd()) //decrease down
{
wAddr = getInstructionRVA(getSelectionEnd() + 1, -2);
int_t wInstrSize = getInstructionRVA(wAddr, 1) - wAddr - 1;
expandSelectionUpTo(wAddr + wInstrSize);
}
else //expand up
{
wAddr = getInstructionRVA(getSelectionStart(), -1);
expandSelectionUpTo(wAddr);
expandSelectionUpTo(wAddr);
}
}
else
{
wAddr = getInstructionRVA(getSelectionStart(), -1);
setSingleSelection(wAddr);
int_t wInstrSize = getInstructionRVA(wAddr, 1) - wAddr - 1;
expandSelectionUpTo(wAddr + wInstrSize);
}
}
@ -1228,6 +1244,8 @@ void Disassembly::disassembleAt(int_t parVA, int_t parCIP, bool history, int_t n
setRowCount(wSize);
setSingleSelection(wRVA); // Selects disassembled instruction
int_t wInstrSize = getInstructionRVA(wRVA, 1) - wRVA - 1;
expandSelectionUpTo(wRVA + wInstrSize);
//set CIP rva
mCipRva = wCipRva;

View File

@ -57,7 +57,11 @@ void HexDump::printDumpAt(int_t parVA, bool select)
setTableOffset((wRVA + mByteOffset) / wBytePerRowCount); //change the displayed offset
if(select)
{
setSingleSelection(wRVA);
int_t wEndingAddress = wRVA + getSizeOf(mDescriptor.at(0).data.itemSize) - 1;
expandSelectionUpTo(wEndingAddress);
}
reloadData();
}
@ -890,7 +894,7 @@ void HexDump::appendResetDescriptor(int width, QString title, bool clickable, Co
int_t wRVA = getTableOffset() * getBytePerRowCount() - mByteOffset;
clearDescriptors();
appendDescriptor(width, title, clickable, descriptor);
printDumpAt(rvaToVa(wRVA), false);
printDumpAt(rvaToVa(wRVA));
}
else
appendDescriptor(width, title, clickable, descriptor);