Skip to content

Commit

Permalink
Add within line boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPl292 committed Oct 15, 2019
1 parent 368ad25 commit 2520855
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/kotlin/org/acejump/view/Boundary.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,26 @@ enum class Boundary: ClosedRange<Int> {
get() = max(editor.caretModel.offset, viewBounds.first)
override val endInclusive: Int
get() = viewBounds.last
},
// Search on the current line
CURRENT_LINE_BOUNDARY {
override val start: Int
get() = editor.document.getLineStartOffset(editor.caretModel.logicalPosition.line)
override val endInclusive: Int
get() = editor.document.getLineEndOffset(editor.caretModel.logicalPosition.line)
},
// Search after caret within line
CURRENT_LINE_AFTER_CARET_BOUNDARY {
override val start: Int
get() = max(editor.caretModel.offset, viewBounds.first)
override val endInclusive: Int
get() = editor.document.getLineEndOffset(editor.caretModel.logicalPosition.line)
},
// Search before caret within line
CURRENT_LINE_BEFORE_CARET_BOUNDARY {
override val start: Int
get() = editor.document.getLineStartOffset(editor.caretModel.logicalPosition.line)
override val endInclusive: Int
get() = min(editor.caretModel.offset, viewBounds.last)
}
}

0 comments on commit 2520855

Please sign in to comment.