Skip to content

Commit 0a35168

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 0a35168

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

app/lib/cubits/current_index.dart

Lines changed: 5 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,10 @@ class CurrentIndexCubit extends Cubit<CurrentIndex> {
758759
return null;
759760
}
760761
final tool = blocState.info.tools[index];
762+
final temporaryHandler = state.temporaryHandler;
763+
if (!force && index == state.index && temporaryHandler != null) {
764+
return temporaryHandler;
765+
}
761766
return changeTemporaryHandler(
762767
context,
763768
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)