MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / repositionCaret

Method repositionCaret

examples/triage/byte.cpp:474–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

472
473
474void ByteView::repositionCaret()
475{
476 updateCache();
477 bool found = false;
478 for (size_t i = 0; i < m_lines.size(); i++)
479 {
480 if (((m_cursorAddr >= m_lines[i].address) && (m_cursorAddr < (m_lines[i].address + m_lines[i].length)))
481 || (((i + 1) == m_lines.size()) && (m_cursorAddr == (m_lines[i].address + m_lines[i].length))))
482 {
483 if (i < m_topLine)
484 m_topLine = i;
485 else if (i > (m_topLine + m_visibleRows - 1))
486 m_topLine = i - (m_visibleRows - 1);
487 m_updatingScrollBar = true;
488 uint64_t addr = m_lines[m_topLine].address;
489 verticalScrollBar()->setValue((int)(getContiguousOffsetForAddress(addr) / m_scrollBarMultiplier));
490 m_updatingScrollBar = false;
491 updateCache();
492 viewport()->update();
493 found = true;
494 break;
495 }
496 }
497 if (!found)
498 {
499 setTopToAddress(m_cursorAddr);
500 refreshLines();
501 showContextAroundTop();
502 }
503 // Force caret to be visible and repaint
504 m_caretBlink = true;
505 m_cursorTimer->stop();
506 m_cursorTimer->start();
507 updateCaret();
508 UIContext::updateStatus();
509 updateCrossReferenceSelection();
510}
511
512
513void ByteView::updateCaret()

Callers

nothing calls this directly

Calls 5

viewportFunction · 0.85
stopMethod · 0.80
sizeMethod · 0.45
updateMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected