Skip to content

Commit

Permalink
Fix indentation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zhelenskiy committed Apr 4, 2024
1 parent cd31669 commit c5d2d7b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,13 @@ public inline fun <T : Token, reified Bracket : ScopeChangingToken> closingBrack
textFieldState.lineOffsets[finishLine]?.let { it + oldOffsetStart } ?: textFieldState.offsets[finishLine].last()
if (position.column > (textFieldState.lineOffsets[finishLine] ?: Int.MAX_VALUE)) return@f null
val token = textFieldState.tokens
.lastOrNull { it is Bracket && it.scopeChange == ScopeChange.OpensScope && it !in matchedBrackets }
?.takeIf { it.text == openingBracket }
.lastOrNull {
it is Bracket && textFieldState.tokenOffsets[it]!!.last < textFieldState.selection.min &&
it.scopeChange == ScopeChange.OpensScope && it.text == openingBracket &&
matchedBrackets[it].let { paired ->
paired == null || textFieldState.tokenOffsets[paired as T]!!.first >= textFieldState.selection.max
}
}
?: return@f null

val openTokenStartPosition = textFieldState.tokenPositions[token]?.first ?: return@f null
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ development=true

#Publication
group=com.zhelenskiy
version=0.0.4
version=0.0.5

0 comments on commit c5d2d7b

Please sign in to comment.