diff --git a/src/Widgets/SearchBar.vala b/src/Widgets/SearchBar.vala index 50520b9c04..42b569714c 100644 --- a/src/Widgets/SearchBar.vala +++ b/src/Widgets/SearchBar.vala @@ -217,6 +217,11 @@ namespace Scratch.Widgets { } public void set_text_view (Scratch.Widgets.SourceView? text_view) { + if (this.text_view == text_view) { + // Do not needlessly recreate SearchContext - may interfere with ongoing search + return; + } + cancel_update_search_widgets (); this.text_view = text_view;