Skip to content

Commit

Permalink
fixes acejump#242
Browse files Browse the repository at this point in the history
  • Loading branch information
breandan committed May 18, 2019
1 parent 5c78f8d commit c1bed03
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/kotlin/org/acejump/search/Finder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import org.acejump.view.Model.editorText
import org.acejump.view.Model.markup
import org.acejump.view.Model.viewBounds
import java.util.*
import kotlin.math.max
import kotlin.math.min
import kotlin.system.measureTimeMillis

/**
Expand Down Expand Up @@ -113,7 +115,7 @@ object Finder: Resettable {
val newHighlights = results.map { index ->
val s = if (index == editorText.length) index - 1 else index
val e = if (model.isRegularExpressions) s + 1 else s + query.length
createTextHighlight(s, e)
createTextHighlight(max(s, 0), min(e, editorText.length - 1))
}

if (!results.isEmpty()) {
Expand Down

0 comments on commit c1bed03

Please sign in to comment.