Skip to content

Commit 3e31be7

Browse files
committed
Fix incorrect comparison of special patterns in non-default orientations
1 parent 7ef8a0c commit 3e31be7

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Common/src/main/kotlin/gay/object/hexdebug/splicing/SplicingTableClientView.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ data class IotaClientView(
5656
fun List<IotaClientView>.toHexpatternSource(): String {
5757
var depth = 0
5858
return joinToString("\n") {
59-
if (it.pattern == SpecialPatterns.RETROSPECTION) depth--
59+
if (it.pattern?.angles == SpecialPatterns.RETROSPECTION.angles) depth--
6060
val indent = " ".repeat(max(0, 4 * depth))
61-
if (it.pattern == SpecialPatterns.INTROSPECTION) depth++
61+
if (it.pattern?.angles == SpecialPatterns.INTROSPECTION.angles) depth++
6262
indent + it.hexpatternSource
6363
}
6464
}

Common/src/main/kotlin/gay/object/hexdebug/utils/Extensions.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ fun Iota.toHexpatternSource(env: CastingEnvironment, wrapEmbedded: Boolean = tru
131131
val iotaText = when (this) {
132132
is PatternIota -> {
133133
// don't wrap known patterns in angled brackets
134-
when (pattern) {
135-
SpecialPatterns.INTROSPECTION -> "{"
136-
SpecialPatterns.RETROSPECTION -> "}"
134+
when (pattern.angles) {
135+
SpecialPatterns.INTROSPECTION.angles -> "{"
136+
SpecialPatterns.RETROSPECTION.angles -> "}"
137137
else -> pattern.getI18nOrNull(env)?.string
138138
}?.let { return it }
139139
// but do wrap unknown ones
@@ -162,11 +162,11 @@ fun HexPattern.getI18nOrNull(env: CastingEnvironment): Component? {
162162
is PatternShapeMatch.PerWorld -> hexAPI.getActionI18n(lookup.key, true)
163163
is PatternShapeMatch.Special -> lookup.handler.name
164164
is PatternShapeMatch.Nothing -> {
165-
val path = when (this) {
166-
SpecialPatterns.INTROSPECTION -> "open_paren"
167-
SpecialPatterns.RETROSPECTION -> "close_paren"
168-
SpecialPatterns.CONSIDERATION -> "escape"
169-
SpecialPatterns.EVANITION -> "undo"
165+
val path = when (this.angles) {
166+
SpecialPatterns.INTROSPECTION.angles -> "open_paren"
167+
SpecialPatterns.RETROSPECTION.angles -> "close_paren"
168+
SpecialPatterns.CONSIDERATION.angles -> "escape"
169+
SpecialPatterns.EVANITION.angles -> "undo"
170170
else -> return null
171171
}
172172
hexAPI.getRawHookI18n(HexAPI.modLoc(path))

0 commit comments

Comments
 (0)