debugger: implement scrolling in the hex view
This commit is contained in:
parent
e2f4103fdc
commit
8c729698a8
|
@ -56,6 +56,17 @@ func (m *HexView) moveSelection(delta int) bool {
|
|||
newAddr := m.selectedAddr + delta
|
||||
if newAddr >= 0 && newAddr < m.mem.Len() {
|
||||
m.selectedAddr = newAddr
|
||||
start, end := m.VisibleBytes()
|
||||
newFirstLine := newAddr / 16
|
||||
if newAddr < start {
|
||||
newFirstLine = newFirstLine - (m.height * 4 / 5)
|
||||
newFirstLine = max(newFirstLine, 0)
|
||||
m.firstAddr = newFirstLine * 16
|
||||
} else if newAddr >= end {
|
||||
newFirstLine = newFirstLine - (m.height * 1 / 5)
|
||||
newFirstLine = min(newFirstLine, (m.mem.Len()/16)-m.height)
|
||||
m.firstAddr = newFirstLine * 16
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
|
|
@ -14,7 +14,7 @@ func main() {
|
|||
}
|
||||
defer dbg.Close()
|
||||
|
||||
mem := memory.New(dbg, 768)
|
||||
mem := memory.New(dbg, 4*1024)
|
||||
|
||||
if err := UI(mem); err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
Loading…
Reference in New Issue