| 695 | } |
| 696 | |
| 697 | void RcxEditor::restoreViewState(const ViewState& vs) { |
| 698 | int maxLine = std::max(0, m_sci->lines() - 1); |
| 699 | int line = std::clamp(vs.cursorLine, 0, maxLine); |
| 700 | long pos = m_sci->SendScintilla(QsciScintillaBase::SCI_FINDCOLUMN, |
| 701 | (unsigned long)line, |
| 702 | (long)std::max(0, vs.cursorCol)); |
| 703 | m_sci->SendScintilla(QsciScintillaBase::SCI_GOTOPOS, (unsigned long)pos); |
| 704 | m_sci->SendScintilla(QsciScintillaBase::SCI_SETFIRSTVISIBLELINE, |
| 705 | (unsigned long)vs.scrollLine); |
| 706 | m_sci->SendScintilla(QsciScintillaBase::SCI_SETXOFFSET, |
| 707 | (unsigned long)vs.xOffset); |
| 708 | } |
| 709 | |
| 710 | const LineMeta* RcxEditor::metaForLine(int line) const { |
| 711 | if (line >= 0 && line < m_meta.size()) |