Skip to content

Commit c23751e

Browse files
committed
Fix temporary tool will be resetted although it is the same index making duplication in selected tool not working, closes #953
1 parent aea0fa3 commit c23751e

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

app/lib/cubits/current_index.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,7 @@ class CurrentIndexCubit extends Cubit<CurrentIndex> {
750750
int index, {
751751
DocumentBloc? bloc,
752752
TemporaryState temporaryState = TemporaryState.allowClick,
753+
bool force = false,
753754
}) async {
754755
bloc ??= context.read<DocumentBloc>();
755756
final blocState = bloc.state;
@@ -758,6 +759,13 @@ class CurrentIndexCubit extends Cubit<CurrentIndex> {
758759
return null;
759760
}
760761
final tool = blocState.info.tools[index];
762+
final temporaryHandler = state.temporaryHandler;
763+
if (!force &&
764+
index == state.index &&
765+
temporaryHandler != null &&
766+
temporaryHandler.data == tool) {
767+
return temporaryHandler;
768+
}
761769
return changeTemporaryHandler(
762770
context,
763771
tool,

metadata/en-US/changelogs/153.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
* Fix pages cannot be removed sometimes
1616
* Fix default page will be recreated on opening ([#952](https://github.com/LinwoodDev/Butterfly/issues/952))
1717
* Fix error when trying to import archive
18+
* Fix temporary tool will be resetted although it is the same index making duplication in selected tool not working ([#953](https://github.com/LinwoodDev/Butterfly/issues/953))
1819

1920
Read more here: https://linwood.dev/butterfly/2.4.1-rc.1

0 commit comments

Comments
 (0)