@@ -8,12 +8,11 @@ import androidx.compose.foundation.shape.RoundedCornerShape
8
8
import androidx.compose.foundation.text.selection.DisableSelection
9
9
import androidx.compose.foundation.text.selection.SelectionContainer
10
10
import androidx.compose.material3.*
11
- import androidx.compose.runtime.Composable
12
- import androidx.compose.runtime.CompositionLocalProvider
13
- import androidx.compose.runtime.remember
11
+ import androidx.compose.runtime.*
14
12
import androidx.compose.ui.Alignment
15
13
import androidx.compose.ui.Modifier
16
14
import androidx.compose.ui.draw.alpha
15
+ import androidx.compose.ui.draw.clip
17
16
import androidx.compose.ui.graphics.Color
18
17
import androidx.compose.ui.platform.LocalClipboardManager
19
18
import androidx.compose.ui.text.*
@@ -23,6 +22,7 @@ import androidx.compose.ui.unit.dp
23
22
import me.yricky.abcde.ui.*
24
23
import me.yricky.oh.abcd.cfm.AbcMethod
25
24
import me.yricky.oh.abcd.code.Code
25
+ import me.yricky.oh.abcd.code.TryBlock
26
26
27
27
val CODE_FONT = FontFamily (Font (" fonts/jbMono/JetBrainsMono-Regular.ttf" ))
28
28
val commentColor = Color (0xff72737a )
@@ -42,24 +42,29 @@ fun CodeViewPage(modifier: Modifier, method: AbcMethod, code: Code?) {
42
42
} to composeContent{
43
43
Column (Modifier .fillMaxSize()) {
44
44
45
- Text (" 寄存器数量:${code.numVRegs} , 参数数量:${code.numArgs} , 指令字节数:${code.codeSize} " ,modifier = Modifier .padding(horizontal = 4 .dp))
45
+ Text (" 寄存器数量:${code.numVRegs} , 参数数量:${code.numArgs} , 指令字节数:${code.codeSize} , TryCatch数: ${code.triesSize} " ,modifier = Modifier .padding(horizontal = 4 .dp))
46
46
CompositionLocalProvider (
47
47
LocalScrollbarStyle provides LocalScrollbarStyle .current.copy(
48
48
unhoverColor = MaterialTheme .colorScheme.tertiary.copy(alpha = 0.2f ),
49
49
hoverColor = MaterialTheme .colorScheme.tertiary
50
50
)
51
51
){
52
52
Box (Modifier .fillMaxWidth().weight(1f ).padding(4 .dp)
53
+ .clip(RoundedCornerShape (8 .dp))
53
54
.border(2 .dp,MaterialTheme .colorScheme.primaryContainer, RoundedCornerShape (8 .dp))
54
55
.padding(8 .dp)
55
56
) {
56
57
SelectionContainer {
58
+ var tryBlock by remember {
59
+ mutableStateOf<TryBlock ?>(null )
60
+ }
57
61
LazyColumnWithScrollBar {
58
62
item {
59
63
Text (method.defineStr(true ), style = codeStyle)
60
64
}
61
65
itemsIndexed(code.asm.list){index,it ->
62
66
Row {
67
+ it.asm
63
68
DisableSelection {
64
69
val line = remember {
65
70
" $index " .let {
@@ -69,7 +74,15 @@ fun CodeViewPage(modifier: Modifier, method: AbcMethod, code: Code?) {
69
74
Text (line, style = codeStyle)
70
75
}
71
76
DisableSelection {
72
- Text (String .format(" %04X " ,it.codeOffset), style = codeStyle.copy(color = commentColor))
77
+ Text (
78
+ String .format(" %04X " ,it.codeOffset),
79
+ style = codeStyle.copy(color = commentColor),
80
+ modifier = with (Modifier ){
81
+ if (it.tryBlock != null ){
82
+ border(1 .dp,Color .Yellow )
83
+ }else this
84
+ }
85
+ )
73
86
}
74
87
TooltipArea (tooltip = {
75
88
DisableSelection {
0 commit comments