Skip to content

Commit

Permalink
Fix Search breadcrumb error
Browse files Browse the repository at this point in the history
  • Loading branch information
ichorid committed Dec 23, 2020
1 parent 1c93a9f commit 6c7a05a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/tribler-gui/tribler_gui/widgets/channelcontentswidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ def initialize_root_model(self, root_model):
self.update_labels()
self.channel_torrents_filter_input.setText("")

def reset_view(self):
self.model.text_filter = ''
def reset_view(self, text_filter=None):
self.model.text_filter = text_filter or ''
self.model.category_filter = None

with self.freeze_controls():
Expand Down Expand Up @@ -270,7 +270,13 @@ def go_back(self, checked=False):
def on_breadcrumb_clicked(self, tgt_level):
if int(tgt_level) + 1 != len(self.channels_stack):
self.go_back_to_level(tgt_level)
elif isinstance(self.model, SearchResultsModel) and len(self.channels_stack) == 1:
# In case of remote search, when only the search results are on the stack,
# we must keep the txt_filter (which contains the search term) before resetting the view
text_filter = self.model.text_filter
self.reset_view(text_filter=text_filter)
else:
# Reset the view if the user clicks on the last part of the breadcrumb
self.reset_view()

def go_back_to_level(self, level):
Expand Down

0 comments on commit 6c7a05a

Please sign in to comment.