blob: 9f649e859f7bfc78a306378749ec757e21b7f3a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# Copyright 2014-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""The search match indicator in the statusbar."""
from qutebrowser.qt.core import pyqtSlot
from qutebrowser.browser import browsertab
from qutebrowser.mainwindow.statusbar import textbase
from qutebrowser.utils import log
class SearchMatch(textbase.TextBase):
"""The part of the statusbar that displays the search match counter."""
@pyqtSlot(browsertab.SearchMatch)
def set_match(self, search_match: browsertab.SearchMatch) -> None:
"""Set the match counts in the statusbar.
Passing SearchMatch(0, 0) hides the match counter.
Args:
search_match: The currently active search match.
"""
if search_match.is_null():
self.setText('')
log.statusbar.debug('Clearing search match text.')
else:
self.setText(f'Match [{search_match}]')
log.statusbar.debug(f'Setting search match text to {search_match}')
|