diff options
author | Zufu Liu <unknown> | 2025-05-18 09:24:34 +1000 |
---|---|---|
committer | Zufu Liu <unknown> | 2025-05-18 09:24:34 +1000 |
commit | 89e74637ef701d63828ef39bc16fb85323f0413c (patch) | |
tree | a6b99908ce4373d60fd1a4f84c0ec06958bbec3c /src/PositionCache.cxx | |
parent | aefa36e90bb7d11881138ec6acd82f245f2c346d (diff) | |
download | scintilla-mirror-89e74637ef701d63828ef39bc16fb85323f0413c.tar.gz |
Modify wrapping fix to be more efficient.
https://github.com/notepad-plus-plus/notepad-plus-plus/pull/16373
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r-- | src/PositionCache.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 89276d2a0..c332af609 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -377,7 +377,10 @@ void LineLayout::WrapLine(const Document *pdoc, Sci::Position posLineStart, Wrap if (!foundBreak) { if (CpUtf8 == pdoc->dbcsCodePage) { // Go back before a base character, commonly a letter as modifiers are after the letter they modify - std::string_view svWithoutLast(&chars[lastLineStart], CharacterBoundary(p + 1, 1) - lastLineStart); + const Sci::Position afterLastCharacter = CharacterBoundary(p + 1, 1); + const Sci::Position afterWrap = std::min<Sci::Position>( + afterLastCharacter, numCharsBeforeEOL + 1); // Limit to one byte of line end + std::string_view svWithoutLast(&chars[lastLineStart], afterWrap - lastLineStart); if (DiscardLastCombinedCharacter(svWithoutLast) && !svWithoutLast.empty()) { lastGoodBreak = lastLineStart + static_cast<Sci::Position>(svWithoutLast.length()); foundBreak = true; |