aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PositionCache.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2022-08-15 17:06:21 +1000
committerNeil <nyamatongwe@gmail.com>2022-08-15 17:06:21 +1000
commitf8236d657fd29f392c3474e96d43a2c73ea216e8 (patch)
treeac214aaad6346a7af948eb43dde77c734fa4e705 /src/PositionCache.cxx
parentd93312d7c9a65b5a41bc4dbf53e81f98d5f2be1f (diff)
downloadscintilla-mirror-f8236d657fd29f392c3474e96d43a2c73ea216e8.tar.gz
Fix bug where deletion at line end indicated with point disappeared when text
inserted on line. Ensure not using old data by clearing all positions - this was hiding problems because deleted positions were still set.
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r--src/PositionCache.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx
index 0104b8660..d36e3e629 100644
--- a/src/PositionCache.cxx
+++ b/src/PositionCache.cxx
@@ -116,6 +116,10 @@ void LineLayout::Free() noexcept {
bidiData.reset();
}
+void LineLayout::ClearPositions() {
+ std::fill(&positions[0], &positions[maxLineLength + 2], 0.0f);
+}
+
void LineLayout::Invalidate(ValidLevel validity_) noexcept {
if (validity > validity_)
validity = validity_;
@@ -301,6 +305,15 @@ Point LineLayout::PointFromPosition(int posInLine, int lineHeight, PointEnd pe)
return pt;
}
+XYPOSITION LineLayout::XInLine(Sci::Position index) const noexcept {
+ // For positions inside line return value from positions
+ // For positions after line return last position + 1.0
+ if (index <= numCharsInLine) {
+ return positions[index];
+ }
+ return positions[numCharsInLine] + 1.0;
+}
+
int LineLayout::EndLineStyle() const noexcept {
return styles[numCharsBeforeEOL > 0 ? numCharsBeforeEOL-1 : 0];
}