Changeset View
Changeset View
Standalone View
Standalone View
src/view/kateview.cpp
Show First 20 Lines • Show All 1963 Lines • ▼ Show 20 Line(s) | 1963 | for (int z = 0; z < l.size(); z++) | |||
---|---|---|---|---|---|
1964 | if ((a = actionCollection()->action(l[z].toAscii().constData()))) { | 1964 | if ((a = actionCollection()->action(l[z].toAscii().constData()))) { | ||
1965 | a->setEnabled(doc()->highlight() && doc()->highlight()->allowsFolding()); | 1965 | a->setEnabled(doc()->highlight() && doc()->highlight()->allowsFolding()); | ||
1966 | } | 1966 | } | ||
1967 | #endif | 1967 | #endif | ||
1968 | } | 1968 | } | ||
1969 | 1969 | | |||
1970 | void KTextEditor::ViewPrivate::ensureCursorColumnValid() | 1970 | void KTextEditor::ViewPrivate::ensureCursorColumnValid() | ||
1971 | { | 1971 | { | ||
1972 | KTextEditor::Cursor c = m_viewInternal->getCursor(); | 1972 | KTextEditor::Cursor c = m_viewInternal->cursorPosition(); | ||
1973 | 1973 | | |||
1974 | // make sure the cursor is valid: | 1974 | // make sure the cursor is valid: | ||
1975 | // - in block selection mode or if wrap cursor is off, the column is arbitrary | 1975 | // - in block selection mode or if wrap cursor is off, the column is arbitrary | ||
1976 | // - otherwise: it's bounded by the line length | 1976 | // - otherwise: it's bounded by the line length | ||
1977 | if (!blockSelection() && wrapCursor() | 1977 | if (!blockSelection() && wrapCursor() | ||
1978 | && (!c.isValid() || c.column() > doc()->lineLength(c.line()))) { | 1978 | && (!c.isValid() || c.column() > doc()->lineLength(c.line()))) { | ||
1979 | c.setColumn(doc()->kateTextLine(cursorPosition().line())->length()); | 1979 | c.setColumn(doc()->kateTextLine(cursorPosition().line())->length()); | ||
1980 | setCursorPosition(c); | 1980 | setCursorPosition(c); | ||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Line(s) | 2052 | { | |||
2066 | } | 2066 | } | ||
2067 | 2067 | | |||
2068 | // show folding bar if "view defaults" says so, otherwise enable/disable only the menu entry | 2068 | // show folding bar if "view defaults" says so, otherwise enable/disable only the menu entry | ||
2069 | updateFoldingConfig(); | 2069 | updateFoldingConfig(); | ||
2070 | } | 2070 | } | ||
2071 | 2071 | | |||
2072 | int KTextEditor::ViewPrivate::virtualCursorColumn() const | 2072 | int KTextEditor::ViewPrivate::virtualCursorColumn() const | ||
2073 | { | 2073 | { | ||
2074 | return doc()->toVirtualColumn(m_viewInternal->getCursor()); | 2074 | return doc()->toVirtualColumn(m_viewInternal->cursorPosition()); | ||
2075 | } | 2075 | } | ||
2076 | 2076 | | |||
2077 | void KTextEditor::ViewPrivate::notifyMousePositionChanged(const KTextEditor::Cursor &newPosition) | 2077 | void KTextEditor::ViewPrivate::notifyMousePositionChanged(const KTextEditor::Cursor &newPosition) | ||
2078 | { | 2078 | { | ||
2079 | emit mousePositionChanged(this, newPosition); | 2079 | emit mousePositionChanged(this, newPosition); | ||
2080 | } | 2080 | } | ||
2081 | 2081 | | |||
2082 | //BEGIN KTextEditor::SelectionInterface stuff | 2082 | //BEGIN KTextEditor::SelectionInterface stuff | ||
▲ Show 20 Lines • Show All 448 Lines • ▼ Show 20 Line(s) | |||||
2531 | 2531 | | |||
2532 | bool KTextEditor::ViewPrivate::setCursorPosition(KTextEditor::Cursor position) | 2532 | bool KTextEditor::ViewPrivate::setCursorPosition(KTextEditor::Cursor position) | ||
2533 | { | 2533 | { | ||
2534 | return setCursorPositionInternal(position, 1, true); | 2534 | return setCursorPositionInternal(position, 1, true); | ||
2535 | } | 2535 | } | ||
2536 | 2536 | | |||
2537 | KTextEditor::Cursor KTextEditor::ViewPrivate::cursorPosition() const | 2537 | KTextEditor::Cursor KTextEditor::ViewPrivate::cursorPosition() const | ||
2538 | { | 2538 | { | ||
2539 | return m_viewInternal->getCursor(); | 2539 | return m_viewInternal->cursorPosition(); | ||
2540 | } | 2540 | } | ||
2541 | 2541 | | |||
2542 | KTextEditor::Cursor KTextEditor::ViewPrivate::cursorPositionVirtual() const | 2542 | KTextEditor::Cursor KTextEditor::ViewPrivate::cursorPositionVirtual() const | ||
2543 | { | 2543 | { | ||
2544 | return KTextEditor::Cursor(m_viewInternal->getCursor().line(), virtualCursorColumn()); | 2544 | return KTextEditor::Cursor(m_viewInternal->cursorPosition().line(), virtualCursorColumn()); | ||
2545 | } | 2545 | } | ||
2546 | 2546 | | |||
2547 | QPoint KTextEditor::ViewPrivate::cursorToCoordinate(const KTextEditor::Cursor &cursor) const | 2547 | QPoint KTextEditor::ViewPrivate::cursorToCoordinate(const KTextEditor::Cursor &cursor) const | ||
2548 | { | 2548 | { | ||
2549 | // map from ViewInternal to View coordinates | 2549 | // map from ViewInternal to View coordinates | ||
2550 | const QPoint pt = m_viewInternal->cursorToCoordinate(cursor, true, false); | 2550 | const QPoint pt = m_viewInternal->cursorToCoordinate(cursor, true, false); | ||
2551 | return pt == QPoint(-1, -1) ? pt : m_viewInternal->mapToParent(pt); | 2551 | return pt == QPoint(-1, -1) ? pt : m_viewInternal->mapToParent(pt); | ||
2552 | } | 2552 | } | ||
▲ Show 20 Lines • Show All 902 Lines • ▼ Show 20 Line(s) | |||||
3455 | { | 3455 | { | ||
3456 | // new ranges with cursor in, default none | 3456 | // new ranges with cursor in, default none | ||
3457 | QSet<Kate::TextRange *> newRangesIn; | 3457 | QSet<Kate::TextRange *> newRangesIn; | ||
3458 | 3458 | | |||
3459 | // on which range set we work? | 3459 | // on which range set we work? | ||
3460 | QSet<Kate::TextRange *> &oldSet = (activationType == KTextEditor::Attribute::ActivateMouseIn) ? m_rangesMouseIn : m_rangesCaretIn; | 3460 | QSet<Kate::TextRange *> &oldSet = (activationType == KTextEditor::Attribute::ActivateMouseIn) ? m_rangesMouseIn : m_rangesCaretIn; | ||
3461 | 3461 | | |||
3462 | // which cursor position to honor? | 3462 | // which cursor position to honor? | ||
3463 | KTextEditor::Cursor currentCursor = (activationType == KTextEditor::Attribute::ActivateMouseIn) ? m_viewInternal->getMouse() : m_viewInternal->getCursor(); | 3463 | KTextEditor::Cursor currentCursor = (activationType == KTextEditor::Attribute::ActivateMouseIn) ? m_viewInternal->mousePosition() : m_viewInternal->cursorPosition(); | ||
3464 | 3464 | | |||
3465 | // first: validate the remembered ranges | 3465 | // first: validate the remembered ranges | ||
3466 | QSet<Kate::TextRange *> validRanges; | 3466 | QSet<Kate::TextRange *> validRanges; | ||
3467 | foreach (Kate::TextRange *range, oldSet) | 3467 | foreach (Kate::TextRange *range, oldSet) | ||
3468 | if (doc()->buffer().rangePointerValid(range)) { | 3468 | if (doc()->buffer().rangePointerValid(range)) { | ||
3469 | validRanges.insert(range); | 3469 | validRanges.insert(range); | ||
3470 | } | 3470 | } | ||
3471 | 3471 | | |||
▲ Show 20 Lines • Show All 341 Lines • Show Last 20 Lines |