[reader mode] fix an easy case of IJPL-29910

GitOrigin-RevId: 31fe02761e99c0824668cc59f1c04b9931c3da00
This commit is contained in:
Vojtech Balik
2024-10-04 20:59:49 +02:00
committed by intellij-monorepo-bot
parent 29bf8c213c
commit eb09ab9d38
2 changed files with 6 additions and 3 deletions

View File

@@ -84,8 +84,7 @@ public class IndentGuideRenderer implements CustomHighlighterRenderer {
var vfmtRightShift = 0;
if (virtualGuideInfo.isVirtualFormattingEnabled(editor)) {
vfmtRightShift = virtualGuideInfo
.getVisualFormattingInlineInlays(editor, doc.getLineStartOffset(doc.getLineNumber(startOffset)),
doc.getLineEndOffset(doc.getLineNumber(startOffset)))
.getVisualFormattingInlineInlays(editor, startOffset, startOffset)
.stream()
.map(inlay -> inlay.getWidthInPixels())
.reduce(0, Integer::sum);

View File

@@ -193,7 +193,11 @@ class VisualFormattingLayerServiceImpl : VisualFormattingLayerService() {
val columnsDelta = replacementColumns - originalColumns
when {
columnsDelta > 0 -> yield(InlineInlay(originalEndOffset, columnsDelta))
columnsDelta > 0 -> {
// If we place the inlay at the right boundary, the inlay will stay even if the whitespace is folded. (as in IJPL-29910)
// In the presence of tabs, however, things get too complicated
yield(InlineInlay(if (originalContainsTabs) originalEndOffset else originalStartOffset, columnsDelta))
}
columnsDelta < 0 -> {
val originalLength = originalEndOffset - originalStartOffset
if (originalContainsTabs) {