diff --git a/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/CodeEditorView.kt b/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/CodeEditorView.kt index fb883820..22d5e386 100644 --- a/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/CodeEditorView.kt +++ b/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/CodeEditorView.kt @@ -74,6 +74,7 @@ import com.sunnychung.application.multiplatform.hellohttp.ux.bigtext.BigTextSimp import com.sunnychung.application.multiplatform.hellohttp.ux.bigtext.BigTextTransformed import com.sunnychung.application.multiplatform.hellohttp.ux.bigtext.BigTextTransformerImpl import com.sunnychung.application.multiplatform.hellohttp.ux.bigtext.BigTextViewState +import com.sunnychung.application.multiplatform.hellohttp.ux.bigtext.abbr import com.sunnychung.application.multiplatform.hellohttp.ux.bigtext.rememberAnnotatedBigTextFieldState import com.sunnychung.application.multiplatform.hellohttp.ux.compose.TextFieldColors import com.sunnychung.application.multiplatform.hellohttp.ux.compose.TextFieldDefaults @@ -615,13 +616,14 @@ fun CodeEditorView( // var bigTextValue by remember(textValue.text.length, textValue.text.hashCode()) { mutableStateOf(BigText.createFromLargeString(text)) } // FIXME performance - LaunchedEffect(bigTextFieldState) { + LaunchedEffect(bigTextFieldState, onTextChange) { bigTextFieldState.valueChangesFlow .debounce(200.milliseconds().toMilliseconds()) .collect { log.d { "bigTextFieldState change ${it.changeId}" } onTextChange?.let { onTextChange -> val string = it.bigText.buildCharSequence() as AnnotatedString + log.v { "${bigTextFieldState.text} : ${it.bigText} onTextChange(${string.text.abbr()})" } onTextChange(string.text) secondCacheKey.value = string.text } diff --git a/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/bigtext/BigMonospaceText.kt b/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/bigtext/BigMonospaceText.kt index d8f8a4ec..40dceff3 100644 --- a/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/bigtext/BigMonospaceText.kt +++ b/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/bigtext/BigMonospaceText.kt @@ -547,7 +547,7 @@ private fun CoreBigMonospaceText( } fun onType(textInput: String) { - log.v { "key in '$textInput'" } + log.v { "$text key in '$textInput' ${viewState.hasSelection()}" } if (viewState.hasSelection()) { deleteSelection(isSaveUndoSnapshot = false) } diff --git a/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/bigtext/BigTextFieldState.kt b/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/bigtext/BigTextFieldState.kt index 34480891..bd20627c 100644 --- a/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/bigtext/BigTextFieldState.kt +++ b/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/bigtext/BigTextFieldState.kt @@ -54,7 +54,7 @@ fun rememberAnnotatedBigTextFieldState(initialValue: String = ""): Pair 20) { substring(0 .. 19) } else {