Skip to content

Commit 6c0fd1c

Browse files
committed
feature #511 Adjust scroll position automatically.
1 parent 6aed9e9 commit 6c0fd1c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

editor/src/main/java/jp/toastkid/editor/view/EditorTabView.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,9 @@ fun EditorTabView(path: String?, initialScrolled: Int, modifier: Modifier) {
297297
viewModel.openExitDialog()
298298
}
299299

300-
/* TODO
301300
LaunchedEffect(viewModel.verticalScrollState().value) {
302301
viewModel.adjustLineNumberState()
303302
}
304-
*/
305303

306304
LaunchedEffect(viewModel.content()) {
307305
snapshotFlow(viewModel::calculateConversionTrigger)

editor/src/main/java/jp/toastkid/editor/view/EditorTabViewModel.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ class EditorTabViewModel {
111111

112112
fun lineNumberScrollState() = lineNumberScrollState
113113

114+
suspend fun adjustLineNumberState() {
115+
lineNumberScrollState.scrollTo(verticalScrollState.value)
116+
}
117+
114118
fun onClickLineNumber(it: Int) {
115119
val multiParagraph = lastParagraph ?: return
116120

0 commit comments

Comments
 (0)