Changeset View
Changeset View
Standalone View
Standalone View
src/view/kateview.cpp
Show First 20 Lines • Show All 1148 Lines • ▼ Show 20 Line(s) | 1102 | if (!doc()->readOnly()) { | |||
---|---|---|---|---|---|
1149 | a->setWhatsThis(i18n("Insert newline including leading characters of the current line which are not letters or numbers.")); | 1149 | a->setWhatsThis(i18n("Insert newline including leading characters of the current line which are not letters or numbers.")); | ||
1150 | scuts.clear(); | 1150 | scuts.clear(); | ||
1151 | scuts << QKeySequence(Qt::SHIFT + Qt::Key_Return) | 1151 | scuts << QKeySequence(Qt::SHIFT + Qt::Key_Return) | ||
1152 | << QKeySequence(Qt::SHIFT + Qt::Key_Enter); | 1152 | << QKeySequence(Qt::SHIFT + Qt::Key_Enter); | ||
1153 | ac->setDefaultShortcuts(a, scuts); | 1153 | ac->setDefaultShortcuts(a, scuts); | ||
1154 | connect(a, SIGNAL(triggered(bool)), SLOT(smartNewline())); | 1154 | connect(a, SIGNAL(triggered(bool)), SLOT(smartNewline())); | ||
1155 | m_editActions << a; | 1155 | m_editActions << a; | ||
1156 | 1156 | | |||
1157 | a = ac->addAction(QStringLiteral("no_indent_newline")); | ||||
1158 | a->setText(i18n("Insert a non-indented Newline")); | ||||
1159 | a->setWhatsThis(i18n("Insert a new line without indentation, regardless of indentation settings.")); | ||||
1160 | scuts.clear(); | ||||
1161 | scuts << QKeySequence(Qt::CTRL + Qt::Key_Return) | ||||
1162 | << QKeySequence(Qt::CTRL + Qt::Key_Enter); | ||||
1163 | ac->setDefaultShortcuts(a, scuts); | ||||
1164 | connect(a, SIGNAL(triggered(bool)), SLOT(noIndentNewline())); | ||||
1165 | m_editActions << a; | ||||
1166 | | ||||
1157 | a = ac->addAction(QStringLiteral("tools_indent")); | 1167 | a = ac->addAction(QStringLiteral("tools_indent")); | ||
1158 | a->setIcon(QIcon::fromTheme(QStringLiteral("format-indent-more"))); | 1168 | a->setIcon(QIcon::fromTheme(QStringLiteral("format-indent-more"))); | ||
1159 | a->setText(i18n("&Indent")); | 1169 | a->setText(i18n("&Indent")); | ||
1160 | a->setWhatsThis(i18n("Use this to indent a selected block of text.<br /><br />" | 1170 | a->setWhatsThis(i18n("Use this to indent a selected block of text.<br /><br />" | ||
1161 | "You can configure whether tabs should be honored and used or replaced with spaces, in the configuration dialog.")); | 1171 | "You can configure whether tabs should be honored and used or replaced with spaces, in the configuration dialog.")); | ||
1162 | ac->setDefaultShortcut(a, QKeySequence(Qt::CTRL + Qt::Key_I)); | 1172 | ac->setDefaultShortcut(a, QKeySequence(Qt::CTRL + Qt::Key_I)); | ||
1163 | connect(a, SIGNAL(triggered(bool)), SLOT(indent())); | 1173 | connect(a, SIGNAL(triggered(bool)), SLOT(indent())); | ||
1164 | 1174 | | |||
▲ Show 20 Lines • Show All 1695 Lines • ▼ Show 20 Line(s) | 2856 | { | |||
2860 | doc()->editStart(); | 2870 | doc()->editStart(); | ||
2861 | doc()->editWrapLine(ln, cursor.column()); | 2871 | doc()->editWrapLine(ln, cursor.column()); | ||
2862 | doc()->insertText(KTextEditor::Cursor(ln + 1, 0), line->string(0, col)); | 2872 | doc()->insertText(KTextEditor::Cursor(ln + 1, 0), line->string(0, col)); | ||
2863 | doc()->editEnd(); | 2873 | doc()->editEnd(); | ||
2864 | 2874 | | |||
2865 | m_viewInternal->updateView(); | 2875 | m_viewInternal->updateView(); | ||
2866 | } | 2876 | } | ||
2867 | 2877 | | |||
2878 | void KTextEditor::ViewPrivate::noIndentNewline() | ||||
2879 | { | ||||
2880 | doc()->newLine(this, KTextEditor::DocumentPrivate::NoIndent); | ||||
2881 | m_viewInternal->iconBorder()->updateForCursorLineChange(); | ||||
dhaumann: Do we really need this call? Also Don't we miss setting the cursor position? Incliding a… | |||||
I assume this is just copied from the normal void KTextEditor::ViewPrivate::keyReturn() doc()->newLine(this); m_viewInternal->iconBorder()->updateForCursorLineChange(); m_viewInternal->updateView(); } ;=) In doubt I would just keep this as is and one can think separately if that is needed in both places. cullmann: I assume this is just copied from the normal
void KTextEditor::ViewPrivate::keyReturn()
{… | |||||
Correct. My reasoning was, it's exactly like keyReturn(), but with a different newLine() call, (i.e. someone else invented the wheel I just pushed in a different direction, so to speak). As for updateForCursorLineChange(), digging around in git history I found this[1], so I guess it's needed. Setting the cursor position and begin/endEdit are handled by DocumentPrivate::newLine(). ahmadsamir: Correct. My reasoning was, it's exactly like keyReturn(), but with a different newLine() call… | |||||
2882 | m_viewInternal->updateView(); | ||||
2883 | } | ||||
2884 | | ||||
2868 | void KTextEditor::ViewPrivate::backspace() | 2885 | void KTextEditor::ViewPrivate::backspace() | ||
2869 | { | 2886 | { | ||
2870 | doc()->backspace(this, cursorPosition()); | 2887 | doc()->backspace(this, cursorPosition()); | ||
2871 | } | 2888 | } | ||
2872 | 2889 | | |||
2873 | void KTextEditor::ViewPrivate::insertTab() | 2890 | void KTextEditor::ViewPrivate::insertTab() | ||
2874 | { | 2891 | { | ||
2875 | doc()->insertTab(this, cursorPosition()); | 2892 | doc()->insertTab(this, cursorPosition()); | ||
▲ Show 20 Lines • Show All 1068 Lines • Show Last 20 Lines |
Do we really need this call? Also Don't we miss setting the cursor position? Incliding a begin/endEdit?