Changeset View
Changeset View
Standalone View
Standalone View
src/view/kateviewinternal.cpp
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | |||||
702 | */ | 702 | */ | ||
703 | void KateViewInternal::makeVisible(const KTextEditor::Cursor &c, int endCol, bool force, bool center, bool calledExternally) | 703 | void KateViewInternal::makeVisible(const KTextEditor::Cursor &c, int endCol, bool force, bool center, bool calledExternally) | ||
704 | { | 704 | { | ||
705 | //qCDebug(LOG_KTE) << "MakeVisible start " << startPos() << " end " << endPos() << " -> request: " << c;// , new start [" << scroll.line << "," << scroll.col << "] lines " << (linesDisplayed() - 1) << " height " << height(); | 705 | //qCDebug(LOG_KTE) << "MakeVisible start " << startPos() << " end " << endPos() << " -> request: " << c;// , new start [" << scroll.line << "," << scroll.col << "] lines " << (linesDisplayed() - 1) << " height " << height(); | ||
706 | // if the line is in a folded region, unfold all the way up | 706 | // if the line is in a folded region, unfold all the way up | ||
707 | //if ( doc()->foldingTree()->findNodeForLine( c.line )->visible ) | 707 | //if ( doc()->foldingTree()->findNodeForLine( c.line )->visible ) | ||
708 | // qCDebug(LOG_KTE)<<"line ("<<c.line<<") should be visible"; | 708 | // qCDebug(LOG_KTE)<<"line ("<<c.line<<") should be visible"; | ||
709 | 709 | | |||
710 | const int lnDisp = linesDisplayed(); | ||||
711 | const bool curBelowScreen = (cache()->displayViewLine(c, true) < 0 && cache()->displayViewLine(c, false) > 0); | ||||
712 | | ||||
710 | if (force) { | 713 | if (force) { | ||
711 | KTextEditor::Cursor scroll = c; | 714 | KTextEditor::Cursor scroll = c; | ||
712 | scrollPos(scroll, force, calledExternally); | 715 | scrollPos(scroll, force, calledExternally); | ||
713 | } else if (center && (c < startPos() || c > endPos())) { | 716 | } else if (center && (c < startPos() || c > endPos())) { | ||
714 | KTextEditor::Cursor scroll = viewLineOffset(c, -int(linesDisplayed()) / 2); | 717 | KTextEditor::Cursor scroll = viewLineOffset(c, -int(lnDisp) / 2); | ||
715 | scrollPos(scroll, false, calledExternally); | 718 | scrollPos(scroll, false, calledExternally); | ||
716 | } else if (c > viewLineOffset(startPos(), linesDisplayed() - m_minLinesVisible - 1)) { | 719 | } else if ((cache()->displayViewLine(c, true) >= (lnDisp - m_minLinesVisible)) || (curBelowScreen)) { | ||
717 | KTextEditor::Cursor scroll = viewLineOffset(c, -(linesDisplayed() - m_minLinesVisible - 1)); | 720 | KTextEditor::Cursor scroll = viewLineOffset(c, -(lnDisp - m_minLinesVisible - 1)); | ||
718 | scrollPos(scroll, false, calledExternally); | 721 | scrollPos(scroll, false, calledExternally); | ||
719 | } else if (c < viewLineOffset(startPos(), m_minLinesVisible)) { | 722 | } else if (c < viewLineOffset(startPos(), m_minLinesVisible)) { | ||
720 | KTextEditor::Cursor scroll = viewLineOffset(c, -m_minLinesVisible); | 723 | KTextEditor::Cursor scroll = viewLineOffset(c, -m_minLinesVisible); | ||
721 | scrollPos(scroll, false, calledExternally); | 724 | scrollPos(scroll, false, calledExternally); | ||
722 | } else { | 725 | } else { | ||
723 | // Check to see that we're not showing blank lines | 726 | // Check to see that we're not showing blank lines | ||
724 | KTextEditor::Cursor max = maxStartPos(); | 727 | KTextEditor::Cursor max = maxStartPos(); | ||
725 | if (startPos() > max) { | 728 | if (startPos() > max) { | ||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |