[terminal] IJPL-178962 BackendTerminalHyperlinkHighlighter formatting

Just some empty lines to split run().
Ideally we need to split it into several methods,
but let's postpone it until the implementation is ready.

GitOrigin-RevId: 37dc4d2c862870dad41b0a8058bf5fddfed25484
This commit is contained in:
Sergei Tachenov
2025-07-29 08:27:10 +00:00
committed by intellij-monorepo-bot
parent 33dffa64f5
commit 2b936d0dea
@@ -128,6 +128,7 @@ internal class BackendTerminalHyperlinkHighlighter(
"startOffset=$startOffset, " +
"trimmed=${outputModel.relativeOffset(0).toAbsolute()}"
}
fun logEvent(event: TerminalHyperlinksChangedEvent) {
if (!LOG.isDebugEnabled) return
count += event.hyperlinks.size
@@ -142,6 +143,7 @@ internal class BackendTerminalHyperlinkHighlighter(
"${first?.absoluteStartOffset?.addRelative()}-${last?.absoluteEndOffset?.addRelative()} (IDs ${last?.id}-${first?.id})"
)
}
suspend fun send(results: List<TerminalFilterResultInfoDto>, firstBatch: Boolean, lastBatch: Boolean) {
require(!(firstBatch && lastBatch))
if (results.isNotEmpty() || firstBatch || lastBatch) {
@@ -150,12 +152,14 @@ internal class BackendTerminalHyperlinkHighlighter(
logEvent(event)
}
}
val lineCount = document.lineCount
if (lineCount == 0) {
send(emptyList(), firstBatch = true, lastBatch = false)
send(emptyList(), firstBatch = false, lastBatch = true)
return
}
val startLineInclusive = document.getLineNumber(startOffset.toRelative())
val endLineInclusive = lineCount - 1
// Process in the reverse direction to highlight the visible part first.
@@ -168,6 +172,7 @@ internal class BackendTerminalHyperlinkHighlighter(
send(batch, firstBatch = endBatchInclusive == endLineInclusive, lastBatch = false)
endBatchInclusive = startBatchInclusive - 1
}
send(emptyList(), firstBatch = false, lastBatch = true)
val lastID = hyperlinkId.get()
LOG.debug {