1
0
mirror of https://github.com/chylex/IntelliJ-AceJump.git synced 2025-05-18 10:34:04 +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 ## Unreleased
## 3.8.16
- Fix issue with unselectable tags, [#446](https://github.com/acejump/AceJump/issues/446)
## 3.8.15 ## 3.8.15
- Forbid jumping to offscreen tags, [#442](https://github.com/acejump/AceJump/issues/442) - 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 { plugins {
idea apply true 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.intellij") version "1.15.0"
id("org.jetbrains.changelog") version "2.2.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 { tasks {
@ -63,7 +63,7 @@ kotlin {
} }
} }
val acejumpVersion = "3.8.15" val acejumpVersion = "3.8.16"
changelog { changelog {
version = acejumpVersion version = acejumpVersion

View File

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