Changeset View
Changeset View
Standalone View
Standalone View
src/view/kateview.cpp
Show First 20 Lines • Show All 2710 Lines • ▼ Show 20 Line(s) | 2710 | { | |||
---|---|---|---|---|---|
2711 | m_doc->editStart(); | 2711 | m_doc->editStart(); | ||
2712 | m_doc->transform(this, m_viewInternal->m_cursor, KTextEditor::DocumentPrivate::Lowercase); | 2712 | m_doc->transform(this, m_viewInternal->m_cursor, KTextEditor::DocumentPrivate::Lowercase); | ||
2713 | m_doc->transform(this, m_viewInternal->m_cursor, KTextEditor::DocumentPrivate::Capitalize); | 2713 | m_doc->transform(this, m_viewInternal->m_cursor, KTextEditor::DocumentPrivate::Capitalize); | ||
2714 | m_doc->editEnd(); | 2714 | m_doc->editEnd(); | ||
2715 | } | 2715 | } | ||
2716 | 2716 | | |||
2717 | void KTextEditor::ViewPrivate::keyReturn() | 2717 | void KTextEditor::ViewPrivate::keyReturn() | ||
2718 | { | 2718 | { | ||
2719 | m_viewInternal->doReturn(); | 2719 | doc()->newLine(this); | ||
2720 | m_viewInternal->iconBorder()->updateForCursorLineChange(); | ||||
2721 | m_viewInternal->updateView(); | ||||
2720 | } | 2722 | } | ||
2721 | 2723 | | |||
2722 | void KTextEditor::ViewPrivate::smartNewline() | 2724 | void KTextEditor::ViewPrivate::smartNewline() | ||
2723 | { | 2725 | { | ||
2724 | m_viewInternal->doSmartNewline(); | 2726 | const KTextEditor::Cursor cursor = cursorPosition(); | ||
2727 | const int ln = cursor.line(); | ||||
2728 | Kate::TextLine line = doc()->kateTextLine(ln); | ||||
2729 | int col = qMin(cursor.column(), line->firstChar()); | ||||
2730 | if (col != -1) { | ||||
2731 | while (line->length() > col && | ||||
2732 | !(line->at(col).isLetterOrNumber() || line->at(col) == QLatin1Char('_')) && | ||||
2733 | col < cursor.column()) { | ||||
2734 | ++col; | ||||
2735 | } | ||||
2736 | } else { | ||||
2737 | col = line->length(); // stay indented | ||||
2738 | } | ||||
2739 | doc()->editStart(); | ||||
2740 | doc()->editWrapLine(ln, cursor.column()); | ||||
2741 | doc()->insertText(KTextEditor::Cursor(ln + 1, 0), line->string(0, col)); | ||||
2742 | doc()->editEnd(); | ||||
2743 | | ||||
2744 | m_viewInternal->updateView(); | ||||
2725 | } | 2745 | } | ||
2726 | 2746 | | |||
2727 | void KTextEditor::ViewPrivate::backspace() | 2747 | void KTextEditor::ViewPrivate::backspace() | ||
2728 | { | 2748 | { | ||
2729 | m_viewInternal->doBackspace(); | 2749 | doc()->backspace(this, cursorPosition()); | ||
2730 | } | 2750 | } | ||
2731 | 2751 | | |||
2732 | void KTextEditor::ViewPrivate::insertTab() | 2752 | void KTextEditor::ViewPrivate::insertTab() | ||
2733 | { | 2753 | { | ||
2734 | m_viewInternal->doTabulator(); | 2754 | doc()->insertTab(this, cursorPosition()); | ||
2735 | } | 2755 | } | ||
2736 | 2756 | | |||
2737 | void KTextEditor::ViewPrivate::deleteWordLeft() | 2757 | void KTextEditor::ViewPrivate::deleteWordLeft() | ||
2738 | { | 2758 | { | ||
2739 | m_viewInternal->doDeletePrevWord(); | 2759 | doc()->editStart(); | ||
2760 | m_viewInternal->wordPrev(true); | ||||
2761 | KTextEditor::Range selection = selectionRange(); | ||||
2762 | removeSelectedText(); | ||||
2763 | doc()->editEnd(); | ||||
2764 | m_viewInternal->tagRange(selection, true); | ||||
2765 | m_viewInternal->updateDirty(); | ||||
2740 | } | 2766 | } | ||
2741 | 2767 | | |||
2742 | void KTextEditor::ViewPrivate::keyDelete() | 2768 | void KTextEditor::ViewPrivate::keyDelete() | ||
2743 | { | 2769 | { | ||
2744 | m_viewInternal->doDelete(); | 2770 | doc()->del(this, cursorPosition()); | ||
2745 | } | 2771 | } | ||
2746 | 2772 | | |||
2747 | void KTextEditor::ViewPrivate::deleteWordRight() | 2773 | void KTextEditor::ViewPrivate::deleteWordRight() | ||
2748 | { | 2774 | { | ||
2749 | m_viewInternal->doDeleteNextWord(); | 2775 | doc()->editStart(); | ||
2776 | m_viewInternal->wordNext(true); | ||||
2777 | KTextEditor::Range selection = selectionRange(); | ||||
2778 | removeSelectedText(); | ||||
2779 | doc()->editEnd(); | ||||
2780 | m_viewInternal->tagRange(selection, true); | ||||
2781 | m_viewInternal->updateDirty(); | ||||
2750 | } | 2782 | } | ||
2751 | 2783 | | |||
2752 | void KTextEditor::ViewPrivate::transpose() | 2784 | void KTextEditor::ViewPrivate::transpose() | ||
2753 | { | 2785 | { | ||
2754 | m_viewInternal->doTranspose(); | 2786 | doc()->transpose(cursorPosition()); | ||
2755 | } | 2787 | } | ||
2756 | 2788 | | |||
2757 | void KTextEditor::ViewPrivate::cursorLeft() | 2789 | void KTextEditor::ViewPrivate::cursorLeft() | ||
2758 | { | 2790 | { | ||
2759 | if (m_viewInternal->m_view->currentTextLine().isRightToLeft()) { | 2791 | if (m_viewInternal->m_view->currentTextLine().isRightToLeft()) { | ||
2760 | m_viewInternal->cursorNextChar(); | 2792 | m_viewInternal->cursorNextChar(); | ||
2761 | } else { | 2793 | } else { | ||
2762 | m_viewInternal->cursorPrevChar(); | 2794 | m_viewInternal->cursorPrevChar(); | ||
▲ Show 20 Lines • Show All 1016 Lines • Show Last 20 Lines |