1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 06:37:17 +00:00

Fix missing regexp after rename

* Doing a full match should be safer to avoid partial results which would result in overly aggressive filtering.
* Add new tests to test suite to cover this issue.
* Fixes #903.
This commit is contained in:
glubsy
2021-06-19 01:52:31 +02:00
parent ab8750eedb
commit a6f83ad3d7
7 changed files with 254 additions and 51 deletions

View File

@@ -116,30 +116,32 @@ class ExcludeListDialog(QDialog):
if not input_text:
self.reset_input_style()
return
# if at least one row matched, we know whether table is highlighted or not
# If at least one row matched, we know whether table is highlighted or not
self._row_matched = self.model.test_string(input_text)
self.table.refresh()
# Test the string currently in the input text box as well
input_regex = self.inputLine.text()
if not input_regex:
self.reset_input_style()
return
compiled = None
try:
compiled = re.compile(input_regex)
except re.error:
self.reset_input_style()
return
if compiled.fullmatch(input_text):
self._input_styled = True
if self.model.is_match(input_text, compiled):
self.inputLine.setStyleSheet("background-color: rgb(10, 200, 10);")
self._input_styled = True
else:
self.reset_input_style()
def reset_input_style(self):
"""Reset regex input line background"""
if self._input_styled:
self._input_styled = False
self.inputLine.setStyleSheet(self.styleSheet())
self._input_styled = False
def reset_table_style(self):
if self._row_matched: