Small cleanup after J2K conversion

See KTIJ-32470

GitOrigin-RevId: 6e2721eeb70de4fd4e66a48074e43e18fd224834
This commit is contained in:
Vladimir Parfinenko
2024-12-10 17:28:44 +00:00
committed by intellij-monorepo-bot
parent 24becf2887
commit 0f261ac63e
2 changed files with 7 additions and 7 deletions
@@ -278,7 +278,7 @@ open class ConsoleViewImpl protected constructor(
}
fun getEffectiveOffset(editor: Editor): Int {
var moveOffset = min(offset.toDouble(), editor.document.textLength.toDouble()).toInt()
var moveOffset = min(offset, editor.document.textLength)
if (ConsoleBuffer.useCycleBuffer() && moveOffset >= editor.document.textLength) {
moveOffset = 0
}
@@ -643,7 +643,8 @@ open class ConsoleViewImpl protected constructor(
if (lineCount != 0) {
val lineStartOffset = document.getLineStartOffset(lineCount - 1)
document.deleteString(
max(lineStartOffset.toDouble(), (document.textLength - backspacePrefixLength).toDouble()).toInt(), document.textLength)
max(lineStartOffset, document.textLength - backspacePrefixLength),
document.textLength)
}
}
addedText = TokenBuffer.getRawText(refinedTokens)
@@ -845,7 +846,7 @@ open class ConsoleViewImpl protected constructor(
val document = editor!!.document
if (document.textLength == 0) return
val endLine = max(0.0, (document.lineCount - 1).toDouble()).toInt()
val endLine = max(0, document.lineCount - 1)
if (canHighlightHyperlinks) {
getHyperlinks()!!.highlightHyperlinksLater(compositeFilter, startLine, endLine, expirableToken)
@@ -873,7 +874,7 @@ open class ConsoleViewImpl protected constructor(
private fun runHeavyFilters(compositeFilter: CompositeFilter, line1: Int, endLine: Int) {
ThreadingAssertions.assertEventDispatchThread()
val startLine = max(0.0, line1.toDouble()).toInt()
val startLine = max(0, line1)
val document = editor!!.document
val startOffset = document.getLineStartOffset(startLine)
@@ -1351,8 +1352,7 @@ open class ConsoleViewImpl protected constructor(
val oldDocLength = document.textLength
document.insertString(offset, text)
val newStartOffset = max(0.0,
(document.textLength - oldDocLength + offset - text.length).toDouble()).toInt() // take care of trim document
val newStartOffset = max(0, document.textLength - oldDocLength + offset - text.length) // take care of trim document
val newEndOffset = document.textLength - oldDocLength + offset // take care of trim document
if (ConsoleTokenUtil.findTokenMarker(this.editor!!, project, newEndOffset) == null) {
@@ -219,7 +219,7 @@ object XBreakpointUtil {
for (line in lineStart..linesEnd) {
var maxPriority = 0
for (type in lineTypes) {
maxPriority = max(maxPriority.toDouble(), type.priority.toDouble()).toInt()
maxPriority = max(maxPriority, type.priority)
val breakpoint = breakpointManager.findBreakpointAtLine(type, file, line)
if ((type.canPutAt(file, line, project) || breakpoint != null) &&
(typeWinner.isEmpty() || type.priority > typeWinner[0].priority)