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