1
0
mirror of https://github.com/chylex/IntelliJ-AceJump.git synced 2025-05-06 14:34:03 +02:00

attempt to fix

This commit is contained in:
breandan 2023-09-16 16:34:46 -04:00
parent 64c6956b88
commit d905909e31
3 changed files with 17 additions and 14 deletions
CHANGES.mdbuild.gradle.kts
src/main/kotlin/org/acejump

View File

@ -2,6 +2,10 @@
## Unreleased
## 3.8.16
- Fix issue with unselectable tags, [#446](https://github.com/acejump/AceJump/issues/446)
## 3.8.15
- Forbid jumping to offscreen tags, [#442](https://github.com/acejump/AceJump/issues/442)

View File

@ -3,10 +3,10 @@ import org.jetbrains.changelog.date
plugins {
idea apply true
kotlin("jvm") version "1.9.10"
kotlin("jvm") version "1.9.20-Beta"
id("org.jetbrains.intellij") version "1.15.0"
id("org.jetbrains.changelog") version "2.2.0"
id("com.github.ben-manes.versions") version "0.47.0"
id("com.github.ben-manes.versions") version "0.48.0"
}
tasks {
@ -63,7 +63,7 @@ kotlin {
}
}
val acejumpVersion = "3.8.15"
val acejumpVersion = "3.8.16"
changelog {
version = acejumpVersion

View File

@ -2,9 +2,11 @@ package org.acejump
import com.anyascii.AnyAscii
import com.intellij.diff.util.DiffUtil.getLineCount
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.editor.*
import it.unimi.dsi.fastutil.ints.IntArrayList
import org.acejump.config.AceConfig
import java.awt.Point
import kotlin.math.*
/**
@ -127,18 +129,15 @@ fun Editor.offsetCenter(first: Int, second: Int): LogicalPosition {
return offsetToLogicalPosition(getLineStartOffset(center))
}
// Borrowed from Editor.calculateVisibleRange() but only available after 232.6095.10
fun Editor.getView(): IntRange {
val firstVisibleLine = max(0, getVisualLineAtTopOfScreen() - 1)
val firstLine = visualLineToLogicalLine(firstVisibleLine)
val startOffset = getLineStartOffset(firstLine)
val height = getScreenHeight() + 2
val lastLine = visualLineToLogicalLine(firstVisibleLine + height)
var endOffset = getLineEndOffset(lastLine, true)
endOffset = normalizeOffset(lastLine, endOffset)
endOffset = min(max(0, document.textLength - 1), endOffset + 1)
return startOffset..endOffset
ApplicationManager.getApplication().assertIsDispatchThread()
val rect = scrollingModel.visibleArea
val startPosition = xyToLogicalPosition(Point(rect.x, rect.y))
val visibleStart = logicalPositionToOffset(startPosition)
val endPosition = xyToLogicalPosition(Point(rect.x + rect.width, rect.y + rect.height))
val visibleEnd = logicalPositionToOffset(LogicalPosition(endPosition.line + 1, 0))
return visibleStart..visibleEnd
}
/**