mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-19 02:48:49 +00:00
Fix Hexdump initial scroll
This commit is contained in:
parent
61fd2b3058
commit
1f6a29b458
@ -284,16 +284,28 @@ void HexdumpWidget::refresh(RVA addr)
|
|||||||
ui->hexASCIIText->setPlainText(hexdump[2]);
|
ui->hexASCIIText->setPlainText(hexdump[2]);
|
||||||
resizeHexdump();
|
resizeHexdump();
|
||||||
|
|
||||||
// Move cursor to desired address
|
|
||||||
|
int seekLine = static_cast<int>((addr - topOffset) / cols);
|
||||||
|
|
||||||
|
// Move cursors to desired address
|
||||||
QTextCursor cur = ui->hexOffsetText->textCursor();
|
QTextCursor cur = ui->hexOffsetText->textCursor();
|
||||||
cur.movePosition(QTextCursor::Start);
|
cur.movePosition(QTextCursor::Start);
|
||||||
cur.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, linesMarginDefault);
|
cur.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, seekLine);
|
||||||
ui->hexOffsetText->setTextCursor(cur);
|
ui->hexOffsetText->setTextCursor(cur);
|
||||||
|
|
||||||
int scroll = static_cast<int>((addr - topOffset) / cols);
|
cur = ui->hexHexText->textCursor();
|
||||||
ui->hexOffsetText->verticalScrollBar()->setValue(scroll);
|
cur.movePosition(QTextCursor::Start);
|
||||||
ui->hexHexText->verticalScrollBar()->setValue(scroll);
|
cur.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, seekLine);
|
||||||
ui->hexASCIIText->verticalScrollBar()->setValue(scroll);
|
ui->hexHexText->setTextCursor(cur);
|
||||||
|
|
||||||
|
cur = ui->hexASCIIText->textCursor();
|
||||||
|
cur.movePosition(QTextCursor::Start);
|
||||||
|
cur.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, seekLine);
|
||||||
|
ui->hexASCIIText->setTextCursor(cur);
|
||||||
|
|
||||||
|
ui->hexOffsetText->verticalScrollBar()->setValue(seekLine);
|
||||||
|
ui->hexHexText->verticalScrollBar()->setValue(seekLine);
|
||||||
|
ui->hexASCIIText->verticalScrollBar()->setValue(seekLine);
|
||||||
|
|
||||||
connectScroll(false);
|
connectScroll(false);
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ QToolTip {
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="verticalScrollBarPolicy">
|
<property name="verticalScrollBarPolicy">
|
||||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="horizontalScrollBarPolicy">
|
<property name="horizontalScrollBarPolicy">
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||||
|
Loading…
Reference in New Issue
Block a user