| 899 | |
| 900 | |
| 901 | void ByteView::pageDown(bool selecting) |
| 902 | { |
| 903 | for (size_t i = 0; i < m_lines.size(); i++) |
| 904 | { |
| 905 | if (((m_cursorAddr >= m_lines[i].address) && (m_cursorAddr < (m_lines[i].address + m_lines[i].length))) |
| 906 | || (((i + 1) == m_lines.size()) && (m_cursorAddr == (m_lines[i].address + m_lines[i].length)))) |
| 907 | { |
| 908 | if (i >= (m_lines.size() - m_visibleRows)) |
| 909 | { |
| 910 | m_cursorAddr = getEnd(); |
| 911 | } |
| 912 | else |
| 913 | { |
| 914 | uint64_t lineOfs = m_cursorAddr - m_lines[i].address; |
| 915 | m_cursorAddr = m_lines[i + m_visibleRows].address + lineOfs; |
| 916 | if (m_cursorAddr < m_lines[i + m_visibleRows].address) |
| 917 | m_cursorAddr = m_lines[i + m_visibleRows].address; |
| 918 | else if (m_cursorAddr >= (m_lines[i + m_visibleRows].address + m_lines[i + m_visibleRows].length)) |
| 919 | m_cursorAddr = m_lines[i + m_visibleRows].address + m_lines[i + m_visibleRows].length - 1; |
| 920 | break; |
| 921 | } |
| 922 | } |
| 923 | } |
| 924 | adjustAddressAfterForwardMovement(); |
| 925 | if ((m_topLine + m_visibleRows) < m_lines.size()) |
| 926 | m_topLine += m_visibleRows; |
| 927 | else if (m_lines.size() > 0) |
| 928 | m_topLine = m_lines.size() - 1; |
| 929 | if (m_topLine < m_lines.size()) |
| 930 | { |
| 931 | m_updatingScrollBar = true; |
| 932 | uint64_t addr = m_lines[m_topLine].address; |
| 933 | verticalScrollBar()->setValue((int)(getContiguousOffsetForAddress(addr) / m_scrollBarMultiplier)); |
| 934 | m_updatingScrollBar = false; |
| 935 | } |
| 936 | if (!selecting) |
| 937 | selectNone(); |
| 938 | repositionCaret(); |
| 939 | viewport()->update(); |
| 940 | } |
| 941 | |
| 942 | |
| 943 | void ByteView::moveToStartOfLine(bool selecting) |