Fixed scroll position not resetting when selecting different files in diff

This commit is contained in:
Abdelilah El Aissaoui 2023-05-11 22:01:06 +02:00
parent 8b74329fb0
commit 86316fca9f
No known key found for this signature in database
GPG Key ID: 7587FC860F594869

View File

@ -90,10 +90,12 @@ class DiffViewModel @Inject constructor(
} }
// If it's a different file or different state (index or workdir), reset the scroll state // If it's a different file or different state (index or workdir), reset the scroll state
if (oldDiffEntryType != null && if (
oldDiffEntryType?.filePath != diffEntryType.filePath ||
oldDiffEntryType is DiffEntryType.UncommitedDiff && oldDiffEntryType is DiffEntryType.UncommitedDiff &&
diffEntryType is DiffEntryType.UncommitedDiff && diffEntryType is DiffEntryType.UncommitedDiff &&
oldDiffEntryType.statusEntry.filePath != diffEntryType.statusEntry.filePath oldDiffEntryType.statusEntry.filePath == diffEntryType.statusEntry.filePath &&
oldDiffEntryType::class != diffEntryType::class
) { ) {
lazyListState.value = LazyListState( lazyListState.value = LazyListState(
0, 0,