KTextEditor
katetextrange.cpp
16 TextRange::TextRange(TextBuffer &buffer, KTextEditor::Range range, InsertBehaviors insertBehavior, EmptyBehavior emptyBehavior)
18 , m_start(buffer, this, range.start(), (insertBehavior & ExpandLeft) ? Kate::TextCursor::StayOnInsert : Kate::TextCursor::MoveOnInsert)
19 , m_end(buffer, this, range.end(), (insertBehavior & ExpandRight) ? Kate::TextCursor::MoveOnInsert : Kate::TextCursor::StayOnInsert)
30 // only place where KTextEditor::LineRange::invalid() for old range makes sense, as we were yet not registered!
61 m_start.setInsertBehavior((_insertBehaviors & ExpandLeft) ? KTextEditor::MovingCursor::StayOnInsert : KTextEditor::MovingCursor::MoveOnInsert);
62 m_end.setInsertBehavior((_insertBehaviors & ExpandRight) ? KTextEditor::MovingCursor::MoveOnInsert : KTextEditor::MovingCursor::StayOnInsert);
126 if (oldLineRange.start() == -1 || (m_start.lineInternal() != -1 && m_start.lineInternal() < oldLineRange.start())) {
161 // for ranges which are allowed to become empty, normalize them, if the end has moved to the front of the start
171 m_buffer.notifyAboutRangeChange(m_view, toLineRange(), false /* attribute not interesting here */);
182 void TextRange::fixLookup(KTextEditor::LineRange oldLineRange, KTextEditor::LineRange lineRange)
195 if (oldLineRange.start() == -1 || (lineRange.start() != -1 && lineRange.start() < oldLineRange.start())) {
214 if ((lineRange.end() < block->startLine()) || (lineRange.start() >= (block->startLine() + block->lines()))) {
259 m_buffer.notifyAboutRangeChange(m_view, toLineRange(), true /* even for nullptr attribute, we had before one => repaint */);
InsertBehaviors insertBehaviors() const override
Get current insert behaviors.
Definition: katetextrange.cpp:70
virtual void rangeInvalid(MovingRange *range)
The range is now invalid (ie.
Definition: movingrangefeedback.cpp:22
constexpr static LineRange invalid() Q_DECL_NOEXCEPT
Returns an invalid line range.
Definition: linerange.h:70
const KTextEditor::MovingCursor & end() const override
Retrieve end cursor of this range, read-only.
Definition: katetextrange.h:134
void setZDepth(qreal zDepth) override
Set the current Z-depth of this range.
Definition: katetextrange.cpp:283
@ ExpandLeft
Expand to encapsulate new characters to the left of the range.
Definition: movingrange.h:156
const TextCursor & endInternal() const
Nonvirtual version of end(), which is faster.
Definition: katetextrange.h:143
Q_SCRIPTABLE Q_NOREPLY void start()
void setAttribute(KTextEditor::Attribute::Ptr attribute) override
Sets the currently active attribute for this range.
Definition: katetextrange.cpp:247
void setView(KTextEditor::View *view) override
Sets the currently active view for this range.
Definition: katetextrange.cpp:230
An object representing lines from a start line to an end line.
Definition: linerange.h:37
EmptyBehavior emptyBehavior() const override
Will this range invalidate itself if it becomes empty?
Definition: katetextrange.h:80
An object representing a section of text, from one Cursor to another.
Definition: include/ktexteditor/range.h:44
void setRange(const KTextEditor::Range &range) override
Set the range of this range.
Definition: katetextrange.cpp:101
int lineInternal() const
Non-virtual version of line(), which is faster.
Definition: katetextcursor.h:123
KTextEditor::LineRange toLineRange() const
Hides parent's impl of toLineRange() and uses non-virtual functions internally.
Definition: katetextrange.h:151
KTextEditor::Attribute::Ptr attribute() const override
Gets the active Attribute for this range.
Definition: katetextrange.h:201
constexpr Cursor end() const Q_DECL_NOEXCEPT
Get the end position of this range.
Definition: include/ktexteditor/range.h:183
@ ExpandRight
Expand to encapsulate new characters to the right of the range.
Definition: movingrange.h:158
void setFeedback(KTextEditor::MovingRangeFeedback *feedback) override
Sets the currently active MovingRangeFeedback for this range.
Definition: katetextrange.cpp:262
int line() const override
Retrieve the line on which this cursor is situated.
Definition: katetextcursor.cpp:124
void setInsertBehavior(InsertBehavior insertBehavior) override
Set insert behavior.
Definition: katetextcursor.h:65
bool isValid() const
Returns whether the current position of this cursor is a valid position, i.e.
Definition: movingcursor.h:159
void setPosition(const TextCursor &position)
Fast way to set the current cursor position to position.
Definition: katetextcursor.cpp:54
const KTextEditor::Range toRange() const
Convert this clever range into a dumb one.
Definition: katetextrange.h:160
void setEmptyBehavior(EmptyBehavior emptyBehavior) override
Set if this range will invalidate itself if it becomes empty.
Definition: katetextrange.cpp:85
constexpr int start() const Q_DECL_NOEXCEPT
Get the start line of this line range.
Definition: linerange.h:105
@ DoNotExpand
Don't expand to encapsulate new characters in either direction. This is the default.
Definition: movingrange.h:154
virtual void rangeEmpty(MovingRange *range)
The range is now empty (ie.
Definition: movingrangefeedback.cpp:18
bool isEmpty() const
Returns true if this range contains no characters, ie.
Definition: movingrange.h:413
void setInsertBehaviors(InsertBehaviors insertBehaviors) override
Set insert behaviors.
Definition: katetextrange.cpp:53
A class which provides notifications of state changes to a MovingRange.
Definition: movingrangefeedback.h:35
KTextEditor::Document * document() const override
Gets the document to which this range is bound.
Definition: katetextrange.cpp:299
constexpr Cursor start() const Q_DECL_NOEXCEPT
Get the start position of this range.
Definition: include/ktexteditor/range.h:173
bool isValid(QStringView ifopt)
KTextEditor::MovingRangeFeedback * feedback() const override
Gets the active MovingRangeFeedback for this range.
Definition: katetextrange.h:229
const TextCursor & startInternal() const
Non-virtual version of start(), which is faster.
Definition: katetextrange.h:125
constexpr int end() const Q_DECL_NOEXCEPT
Get the end line of this line range.
Definition: linerange.h:115
KTextEditor::View * view() const override
Gets the active view for this range.
Definition: katetextrange.h:181
void setAttributeOnlyForViews(bool onlyForViews) override
Set if this range's attribute is only visible in views, not for example prints.
Definition: katetextrange.cpp:277
constexpr static Range invalid() Q_DECL_NOEXCEPT
Returns an invalid range.
Definition: include/ktexteditor/range.h:115
TextRange(TextBuffer &buffer, KTextEditor::Range range, InsertBehaviors insertBehavior, EmptyBehavior emptyBehavior=AllowEmpty)
Construct a text range.
Definition: katetextrange.cpp:16
InsertBehavior insertBehavior() const override
Get current insert behavior.
Definition: katetextcursor.h:74
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 03:48:54 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 03:48:54 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.