Scratch: associate inlay with preceding text

This allow to avoid some unintentional movements of caret after inserting scratch output
This commit is contained in:
Natalia Selezneva
2019-01-17 10:42:41 +03:00
parent 290ae16235
commit 76b06cd747
3 changed files with 7 additions and 3 deletions
@@ -74,7 +74,11 @@ object InlayScratchOutputHandler : ScratchOutputHandler {
if (shortText != text) {
printToToolWindow(file, expression, output)
}
editor.inlayModel.addInlineElement(lineEndOffset, InlayScratchFileRenderer(" ".repeat(spaceCount) + shortText, output.type))
editor.inlayModel.addInlineElement(
lineEndOffset,
true,
InlayScratchFileRenderer(" ".repeat(spaceCount) + shortText, output.type)
)
}
val existing = editor.inlayModel
+1 -1
View File
@@ -1 +1 @@
foo()
foo()
+1 -1
View File
@@ -2,4 +2,4 @@ val a = "a".repeat(100)
a
val b = "0123456789\n".repeat(10)
b
println("0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789")
println("0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789")