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

Method repositionCaret

python/examples/triage/byte.py:393–420  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

391 self.updateCache()
392
393 def repositionCaret(self):
394 self.updateCache()
395 found = False
396 for i in range(0, len(self.lines)):
397 if (((self.cursorAddr >= self.lines[i].address) and (self.cursorAddr < (self.lines[i].address + self.lines[i].length))) or
398 (((i + 1) == len(self.lines)) and (self.cursorAddr == (self.lines[i].address + self.lines[i].length)))):
399 if i < self.topLine:
400 self.topLine = i
401 elif i > (self.topLine + self.visibleRows - 1):
402 self.topLine = i - (self.visibleRows - 1)
403 self.updatingScrollBar = True
404 addr = self.lines[self.topLine].address
405 self.verticalScrollBar().setValue(self.getContiguousOffsetForAddress(addr) // self.scrollBarMultiplier)
406 self.updatingScrollBar = False
407 self.updateCache()
408 self.viewport().update()
409 found = True
410 break
411 if not found:
412 self.setTopToAddress(self.cursorAddr)
413 self.refreshLines()
414 self.showContextAroundTop()
415 # Force caret to be visible and repaint
416 self.caretBlink = True
417 self.cursorTimer.stop()
418 self.cursorTimer.start()
419 self.updateCaret()
420 UIContext.updateStatus()
421
422 def updateCaret(self):
423 # Rerender both the old caret position and the new caret position

Callers 12

navigateMethod · 0.95
selectNoneMethod · 0.95
leftMethod · 0.95
rightMethod · 0.95
pageUpMethod · 0.95
pageDownMethod · 0.95
moveToStartOfLineMethod · 0.95
moveToEndOfLineMethod · 0.95
moveToStartOfViewMethod · 0.95
moveToEndOfViewMethod · 0.95
mousePressEventMethod · 0.95
mouseMoveEventMethod · 0.95

Calls 9

updateCacheMethod · 0.95
setTopToAddressMethod · 0.95
refreshLinesMethod · 0.95
showContextAroundTopMethod · 0.95
updateCaretMethod · 0.95
stopMethod · 0.80
updateMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected