override fun shouldHighlight()

in terminal/src/main/kotlin/com/intellij/ideolog/terminal/highlighting/TerminalCommandBlockHighlighter.kt [24:42]


  override fun shouldHighlight(startOffset: Int): Boolean {
    if (!Registry.`is`("ideolog.terminal.enabled")) return false
    if (!::editor.isInitialized) return false
    val document = editor.document
    val lineNumber = document.getLineNumber(startOffset)
    val dummyHighlightingInfo = HighlightingInfo(startOffset)
    synchronized(highlightingInfos) {
      val lowerBoundInfo = highlightingInfos.floor(dummyHighlightingInfo) ?: return false

      return if (lowerBoundInfo.commandStartOffset == startOffset)
        false
      else {
        val followingInfo = highlightingInfos.higher(dummyHighlightingInfo)
                            ?: return lowerBoundInfo.shouldHighlight // startOffset from the last command
        if (document.lineCount > lineNumber + 1 && followingInfo.commandStartOffset == document.getLineStartOffset(lineNumber + 1)) false
        else lowerBoundInfo.shouldHighlight
      }
    }
  }