| 857 | |
| 858 | |
| 859 | void ByteView::pageUp(bool selecting) |
| 860 | { |
| 861 | for (size_t i = 0; i < m_lines.size(); i++) |
| 862 | { |
| 863 | if (((m_cursorAddr >= m_lines[i].address) && (m_cursorAddr < (m_lines[i].address + m_lines[i].length))) |
| 864 | || (((i + 1) == m_lines.size()) && (m_cursorAddr == (m_lines[i].address + m_lines[i].length)))) |
| 865 | { |
| 866 | if (i < m_visibleRows) |
| 867 | { |
| 868 | m_cursorAddr = getStart(); |
| 869 | } |
| 870 | else |
| 871 | { |
| 872 | uint64_t lineOfs = m_cursorAddr - m_lines[i].address; |
| 873 | m_cursorAddr = m_lines[i - m_visibleRows].address + lineOfs; |
| 874 | if (m_cursorAddr < m_lines[i - m_visibleRows].address) |
| 875 | m_cursorAddr = m_lines[i - m_visibleRows].address; |
| 876 | else if (m_cursorAddr >= (m_lines[i - m_visibleRows].address + m_lines[i - m_visibleRows].length)) |
| 877 | m_cursorAddr = m_lines[i - m_visibleRows].address + m_lines[i - m_visibleRows].length - 1; |
| 878 | break; |
| 879 | } |
| 880 | } |
| 881 | } |
| 882 | adjustAddressAfterBackwardMovement(); |
| 883 | if (m_topLine > m_visibleRows) |
| 884 | m_topLine -= m_visibleRows; |
| 885 | else |
| 886 | m_topLine = 0; |
| 887 | if (m_topLine < m_lines.size()) |
| 888 | { |
| 889 | m_updatingScrollBar = true; |
| 890 | uint64_t addr = m_lines[m_topLine].address; |
| 891 | verticalScrollBar()->setValue((int)(getContiguousOffsetForAddress(addr) / m_scrollBarMultiplier)); |
| 892 | m_updatingScrollBar = false; |
| 893 | } |
| 894 | if (!selecting) |
| 895 | selectNone(); |
| 896 | repositionCaret(); |
| 897 | viewport()->update(); |
| 898 | } |
| 899 | |
| 900 | |
| 901 | void ByteView::pageDown(bool selecting) |