KTextEditor
katecmds.cpp
64 "<p>Cleans up the indentation of the selected lines or current line according to the indentation settings in the document. </p>");
69 "<p>Inserts comment markers to make the selection or selected lines or current line a comment according to the text format as defined by the "
75 "<p>Removes comment markers from the selection or selected lines or current line according to the text format as defined by the syntax highlight "
86 "<p>If enabled, indentation of text pasted from the clipboard is adjusted using the current indenter.</p>"
126 "<p>Sets the indentation width to the number <b>width</b>. Used only if you are indenting with spaces.</p>");
171 "<p>Sets the line width for hard wrapping to <b>width</b>. This is used if you are having your text wrapped automatically.</p>");
206bool KateCommands::CoreCommands::exec(KTextEditor::View *view, const QString &_cmd, QString &errorMsg, const KTextEditor::Range &range)
259 return (v->textFolding().newFoldingRange(range.isValid() ? range : v->selectionRange(), Kate::TextFolding::Persistent | Kate::TextFolding::Folded)
262 return (v->textFolding().newFoldingRange(range.isValid() ? range : v->selectionRange(), Kate::TextFolding::Folded) != -1);
264 QList<QPair<qint64, Kate::TextFolding::FoldingRangeFlags>> startingRanges = v->textFolding().foldingRangesStartingOnLine(v->cursorPosition().line());
311 else if (cmd == QLatin1String("set-indent-mode") || cmd == QLatin1String("set-highlight") || cmd == QLatin1String("set-mode")) {
337 else if (cmd == QLatin1String("set-tab-width") || cmd == QLatin1String("set-indent-width") || cmd == QLatin1String("set-word-wrap-column")
385 else if (cmd == QLatin1String("set-icon-border") || cmd == QLatin1String("set-folding-markers") || cmd == QLatin1String("set-indent-pasted-text")
386 || cmd == QLatin1String("set-line-numbers") || cmd == QLatin1String("set-replace-tabs") || cmd == QLatin1String("set-show-tabs")
387 || cmd == QLatin1String("set-word-wrap") || cmd == QLatin1String("set-wrap-cursor") || cmd == QLatin1String("set-replace-tabs-save")
425 if (tmp == QLatin1String("1") || tmp == QLatin1String("modified") || tmp == QLatin1String("mod") || tmp == QLatin1String("+")) {
427 } else if (tmp == QLatin1String("2") || tmp == QLatin1String("all") || tmp == QLatin1String("*")) {
450KCompletion *KateCommands::CoreCommands::completionObject(KTextEditor::View *view, const QString &cmd)
504bool KateCommands::Character::exec(KTextEditor::View *view, const QString &_cmd, QString &, const KTextEditor::Range &)
509 static const QRegularExpression num(QStringLiteral("^char *(0?x[0-9A-Fa-f]{1,4}|0[0-7]{1,6}|[0-9]{1,5})$"));
561 "<p>Inserts a date/time string as defined by the specified format, or the format yyyy-MM-dd hh:mm:ss if none is specified.</p>"
573 "<tr><td>h</td><td>The hour without a leading zero (0..23 or 1..12 if AM/PM display).</td></tr>"
574 "<tr><td>hh</td><td>The hour with a leading zero (00..23 or 01..12 if AM/PM display).</td></tr>"
581 "<tr><td>AP</td><td>Use AM/PM display. AP will be replaced by either \"AM\" or \"PM\".</td></tr>"
589bool KateCommands::Date::exec(KTextEditor::View *view, const QString &cmd, QString &, const KTextEditor::Range &)
596 view->document()->insertText(view->cursorPosition(), QDateTime::currentDateTime().toString(cmd.mid(5, cmd.length() - 5)));
598 view->document()->insertText(view->cursorPosition(), QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd hh:mm:ss")));
618QList<KateCommands::EditingCommands::EditingCommand> KateCommands::EditingCommands::allCommands()
622 {.name = i18n("Remove Duplicates and Sort Text Alphabetically"), .cmd = QStringLiteral("sortuniq")},
629bool KateCommands::EditingCommands::exec(KTextEditor::View *view, const QString &cmd, QString &, const KTextEditor::Range &)
645 auto apply = [](KTextEditor::Range range, KTextEditor::Document *doc, const QStringList &lines) {
695bool KateCommands::EditingCommands::help(class KTextEditor::View *, const QString &cmd, QString &msg)
704 "<p>Remove duplicate lines from the selected text or whole document if there is no selection.</p>");
712 "<p>Sort the selected text or whole document in natural order.<br>Here is an example to show the difference to the normal sort "
virtual void setIgnoreCase(bool ignoreCase)
virtual void setItems(const QStringList &itemList)
constexpr int line() const noexcept
Retrieve the line on which this cursor is situated.
Definition cursor.h:174
Backend of KTextEditor::Document related public KTextEditor interfaces.
Definition katedocument.h:68
bool setHighlightingMode(const QString &name) override
Set the current mode of the document by giving its name.
Definition katedocument.cpp:1836
bool setMode(const QString &name) override
Set the current mode of the document by giving its name.
Definition katedocument.cpp:1808
bool editStart()
Enclose editor actions with editStart() and editEnd() to group them.
Definition katedocument.cpp:971
void setDontChangeHlOnSave()
allow to mark, that we changed hl on user wish and should not reset it atm used for the user visible ...
Definition katedocument.cpp:1883
void rememberUserDidSetIndentationMode()
set indentation mode by user this will remember that a user did set it and will avoid reset on save
Definition katedocument.h:1108
virtual int lineLength(int line) const =0
Get the length of a given line in characters.
virtual bool insertText(KTextEditor::Cursor position, const QString &text, bool block=false)=0
Insert text at position.
An object representing a section of text, from one Cursor to another.
Definition include/ktexteditor/range.h:49
constexpr Cursor end() const noexcept
Get the end position of this range.
Definition include/ktexteditor/range.h:163
constexpr Cursor start() const noexcept
Get the start position of this range.
Definition include/ktexteditor/range.h:153
void setRange(Range range) noexcept
Set the start and end cursors to range.start() and range.end() respectively.
Definition utils/range.cpp:35
virtual Document * document() const =0
Get the view's document, that means the view is a view of the returned document.
virtual Cursor cursorPosition() const =0
Get the view's current cursor position.
virtual bool selection() const =0
Query the view whether it has selected text, i.e.
virtual Range selectionRange() const =0
Get the range occupied by the current selection.
A KCompletion object that completes last ?unquoted? word in the string passed.
Definition katecmd.h:58
insert a unicode or ascii character base 9+1: 1234 hex: 0x1234 or x1234 octal: 01231
Definition katecmds.h:118
bool help(class KTextEditor::View *, const QString &, QString &) override
This command does not have help.
Definition katecmds.cpp:489
bool exec(class KTextEditor::View *view, const QString &cmd, QString &errorMsg, const KTextEditor::Range &range=KTextEditor::Range(-1, -0, -1, 0)) override
execute command
Definition katecmds.cpp:504
This KTextEditor::Command provides access to a lot of the core functionality of kate part,...
Definition katecmds.h:31
bool help(class KTextEditor::View *, const QString &, QString &) override
This command does not have help.
Definition katecmds.cpp:48
bool exec(class KTextEditor::View *view, const QString &cmd, QString &errorMsg)
execute command
bool supportsRange(const QString &range) override
Find out if a given command can act on a range.
Definition katecmds.cpp:438
KCompletion * completionObject(KTextEditor::View *, const QString &) override
override from KTextEditor::Command
Definition katecmds.cpp:450
bool help(class KTextEditor::View *, const QString &, QString &) override
This command does not have help.
Definition katecmds.cpp:556
bool exec(class KTextEditor::View *view, const QString &cmd, QString &errorMsg, const KTextEditor::Range &range=KTextEditor::Range(-1, -0, -1, 0)) override
execute command
Definition katecmds.cpp:589
void setShowIndentLines(bool showLines)
Set whether a guide should be painted to help identifying indent lines.
Definition katerenderer.cpp:126
bool unfoldRange(qint64 id, bool remove=false)
Unfold the given range.
Definition katetextfolding.cpp:148
QList< QPair< qint64, FoldingRangeFlags > > foldingRangesStartingOnLine(int line) const
Queries which folding ranges start at the given line and returns the id + flags for all of them.
Definition katetextfolding.cpp:363
qint64 newFoldingRange(KTextEditor::Range range, FoldingRangeFlags flags=FoldingRangeFlags())
Create a new folding range.
Definition katetextfolding.cpp:76
Q_SCRIPTABLE Q_NOREPLY void start()
QString i18n(const char *text, const TYPE &arg...)
KGuiItem apply()
const QList< QKeySequence > & end()
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Definition katetextblock.h:18
void setNumericMode(bool on)
QDateTime currentDateTime()
QString toString(QStringView format, QCalendar cal) const const
iterator begin()
qsizetype count() const const
iterator end()
iterator erase(const_iterator begin, const_iterator end)
T & first()
bool isEmpty() const const
void push_back(parameter_type value)
void reserve(qsizetype size)
qsizetype size() const const
value_type takeFirst()
QRegularExpressionMatch match(QStringView subjectView, qsizetype offset, MatchType matchType, MatchOptions matchOptions) const const
iterator end()
iterator find(const T &value)
iterator insert(const T &value)
QString fromLatin1(QByteArrayView str)
qsizetype length() const const
QString mid(qsizetype position, qsizetype n) const const
QString & remove(QChar ch, Qt::CaseSensitivity cs)
QStringList split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
QString toLower() const const
ushort toUShort(bool *ok, int base) const const
QString trimmed() const const
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
QString join(QChar separator) const const
SkipEmptyParts
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:56:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:56:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.