mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-18 04:21:24 +07:00
[pycharm] PY-87579 Tweak autoscroll logic
Reliance on `selectableLazyListState`'s `canScrollBackward` sometimes ceases to trigger snapshot flow updates. Reference solution uses `firstVisibleItemIndex` instead, which seems to behave more predictably. Merge-request: IJ-MR-191437 Merged-by: David Lysenko <david.lysenko@jetbrains.com> GitOrigin-RevId: 69f2b0904dad21acf7b04e312cb7eb8304ee72f3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
40ab77d1f3
commit
3bc73f0be0
@@ -560,13 +560,13 @@ class ProcessOutputControllerService(
|
||||
private fun ensureProcessTreeScroll() {
|
||||
coroutineScope.launch(Dispatchers.EDT) {
|
||||
combine(
|
||||
snapshotFlow { processTreeUiState.selectableLazyListState.canScrollBackward },
|
||||
snapshotFlow { processTreeUiState.selectableLazyListState.firstVisibleItemIndex },
|
||||
shouldScrollToTop,
|
||||
) { canScrollBackwards, processes -> canScrollBackwards to processes }
|
||||
) { firstVisibleIndex, processes -> (firstVisibleIndex > 0) to processes }
|
||||
.collect { (canScrollBackwards, shouldScrollToTopValue) ->
|
||||
if (canScrollBackwards && shouldScrollToTopValue) {
|
||||
shouldScrollToTop.value = false
|
||||
processTreeUiState.selectableLazyListState.lazyListState.scrollToItem(0)
|
||||
processTreeUiState.selectableLazyListState.scrollToItem(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user