From f8236d657fd29f392c3474e96d43a2c73ea216e8 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 15 Aug 2022 17:06:21 +1000 Subject: 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. --- src/PositionCache.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/PositionCache.cxx') 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]; } -- cgit v1.2.3