KTextEditor
katebuffer.cpp
109 const auto proberType = (KEncodingProber::ProberType)KateGlobalConfig::global()->value(KateGlobalConfig::EncodingProberType).toInt();
129 // will allow to do "kate newfile.txt" without error messages but still fail if e.g. you mistype a url
136 KTextEditor::Message *message = new KTextEditor::Message(i18nc("short translation, user created new file", "New file"), KTextEditor::Message::Warning);
154 if (!load(m_file, m_brokenEncoding, m_tooLongLinesWrapped, m_longestLineLoaded, enforceTextCodec)) {
178 if (const auto setEncoding = QStringConverter::encodingForName(m_doc->config()->encoding().toUtf8().constData())) {
334 qCDebug(LOG_KTE) << "HIGHLIGHTED START --- NEED HL, LINESTART: " << startLine << " LINEEND: " << endLine;
361 qCDebug(LOG_KTE) << "text length: " << textLine->length() << " attribute list size: " << textLine->attributesList().size();
365 qCDebug(LOG_KTE) << "start: " << ml.at(i - 2) << " len: " << ml.at(i - 1) << " at: " << ml.at(i) << " ";
395 qMin(lines() - 1, (last_line_spellchecking == -1) ? qMax(current_line, oldHighlighted) : last_line_spellchecking));
400 qCDebug(LOG_KTE) << "HIGHLIGHTED END --- NEED HL, LINESTART: " << startLine << " LINEEND: " << endLine;
402 qCDebug(LOG_KTE) << "HL DYN COUNT: " << KateHlManager::self()->countDynamicCtxs() << " MAX: " << m_maxDynamicContexts;
450 if (m_highlight->foldingIndentationSensitive() && (tabWidth() > 0) && startTextLine.highlightingState().indentationBasedFoldingEnabled()
527 return KTextEditor::Range(KTextEditor::Cursor(startLine, 0), KTextEditor::Cursor(lastLine, plainLine(lastLine).length()));
562 foldingStartToOffsetAndCount.insert(startLineAttributes[i].foldingRegion.id(), qMakePair(startLineAttributes[i].offset, 1));
590 if (lineAttributes[i].foldingRegion.type() == KSyntaxHighlighting::FoldingRegion::End && lineAttributes[i].foldingRegion.id() == openedRegionType) {
602 return KTextEditor::Range(KTextEditor::Cursor(startLine, openedRegionOffset), KTextEditor::Cursor(line, lineAttributes[i].offset));
615 return KTextEditor::Range(KTextEditor::Cursor(startLine, openedRegionOffset), KTextEditor::Cursor(lines() - 1, plainLine(lines() - 1).length()));
QUrl url() const
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 postMessage(KTextEditor::Message *message) override
Post message to the Document and its Views.
Definition katedocument.cpp:6514
int lineLengthLimit() const
reads the line length limit from config, if it is not overridden
Definition katedocument.cpp:2304
void setAutoHide(int delay=0)
Set the auto hide time to delay milliseconds.
Definition messageinterface.cpp:90
void setPosition(MessagePosition position)
Sets the position of the message to position.
Definition messageinterface.cpp:150
An object representing a section of text, from one Cursor to another.
Definition include/ktexteditor/range.h:49
static constexpr Range invalid() noexcept
Returns an invalid range.
Definition include/ktexteditor/range.h:121
KTextEditor::Range computeFoldingRangeForStartLine(int startLine)
For a given line, compute the folding range that starts there to be used to fold e....
Definition katebuffer.cpp:474
bool openFile(const QString &m_file, bool enforceTextCodec)
Open a file, use the given filename.
Definition katebuffer.cpp:106
std::pair< bool, bool > isFoldingStartingOnLine(int startLine)
For a given line, compute if folding starts here.
Definition katebuffer.cpp:428
void wrapLine(const KTextEditor::Cursor position) override
Wrap line at given cursor position.
Definition katebuffer.cpp:259
void updateHighlighting()
Update highlighting of the lines in last edit transaction.
Definition katebuffer.cpp:75
void ensureHighlighted(int line, int lookAhead=64)
Update highlighting of given line line, if needed.
Definition katebuffer.cpp:240
void tagLines(KTextEditor::LineRange lineRange)
Emitted when the highlighting of a certain range has changed.
bool saveFile(const QString &m_file)
Save the buffer to a file, use the given filename + codec + end of line chars (internal use of qtexts...
Definition katebuffer.cpp:212
KateHighlighting::Foldings computeFoldings(int line)
Compute folding vector for the given line, will internally do a re-highlighting.
Definition katebuffer.cpp:407
void setEncodingProberType(KEncodingProber::ProberType proberType)
Set encoding prober type for this buffer to use for load.
Definition katetextbuffer.h:83
virtual bool save(const QString &filename)
Save the current buffer content to the given file.
Definition katetextbuffer.cpp:805
virtual void wrapLine(const KTextEditor::Cursor position)
Wrap line at given cursor position.
Definition katetextbuffer.cpp:334
int editingMaximalLineChanged() const
Get maximal line number changed by last editing transaction.
Definition katetextbuffer.h:343
void setFallbackTextCodec(const QString &codec)
Set fallback codec for this buffer to use for load.
Definition katetextbuffer.h:101
bool editingChangedBuffer() const
Query information from the last editing transaction: was the content of the buffer changed?...
Definition katetextbuffer.h:315
void setLineMetaData(int line, const TextLine &textLine)
Transfer all non text attributes for the given line from the given text line to the one in the buffer...
Definition katetextbuffer.cpp:202
void setEndOfLineMode(EndOfLineMode endOfLineMode)
Set end of line mode for this buffer, not allowed to be set to unknown.
Definition katetextbuffer.h:156
void setTextCodec(const QString &codec)
Set codec for this buffer to use for load/save.
Definition katetextbuffer.cpp:785
virtual bool load(const QString &filename, bool &encodingErrors, bool &tooLongLinesWrapped, int &longestLineLoaded, bool enforceTextCodec)
Load the given file.
Definition katetextbuffer.cpp:643
virtual bool startEditing()
Start an editing transaction, the wrapLine/unwrapLine/insertText and removeText functions are only al...
Definition katetextbuffer.cpp:285
virtual void clear()
Clears the buffer, reverts to initial empty state.
Definition katetextbuffer.cpp:136
int editingMinimalLineChanged() const
Get minimal line number changed by last editing transaction.
Definition katetextbuffer.h:334
void setGenerateByteOrderMark(bool generateByteOrderMark)
Generate byte order mark on save.
Definition katetextbuffer.h:137
const QString & text() const
Accessor to the text contained in this line.
Definition katetextline.h:89
const QList< Attribute > & attributesList() const
Accessor to attributes.
Definition katetextline.h:333
int indentDepth(int tabWidth) const
Returns the indentation depth with each tab expanded into tabWidth characters.
Definition katetextline.cpp:59
Q_SCRIPTABLE Q_NOREPLY void start()
QString i18nc(const char *context, const char *text, const TYPE &arg...)
const char * constData() const const
bool exists(const QString &path)
bool isFile() const const
iterator end()
iterator erase(const_iterator pos)
iterator find(const Key &key)
iterator insert(const Key &key, const T &value)
bool hasNext() const const
const Key & key() const const
Item next()
const T & value() const const
Q_EMITQ_EMIT
bool isEmpty() const const
QByteArray toUtf8() const const
std::optional< Encoding > encodingForName(const char *name)
bool hasError() const const
DecodedData< QStringView > encode(QStringView in)
bool isLocalFile() const const
int toInt(bool *ok) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:53:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:53:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.