Code cleanp scan through

This commit is contained in:
2026-02-22 21:53:53 -06:00
parent 88a6451fa8
commit 13f2750a7e
12 changed files with 27 additions and 34 deletions

View File

@@ -132,12 +132,10 @@ class Colorize(ColorConverterMixin):
if not start_itr:
start_itr = buffer.get_start_iter()
results = self.search(start_itr, end_itr, "#")
return results
return self.search(start_itr, end_itr, "#")
def search(self, start_itr = None, end_itr = None, query: str = None) -> list:
if not start_itr or not query: return None, None
if not start_itr or not query: return []
results: list = []
flags = Gtk.TextSearchFlags.VISIBLE_ONLY | Gtk.TextSearchFlags.TEXT_ONLY
@@ -150,7 +148,7 @@ class Colorize(ColorConverterMixin):
return results
def finalize_non_hex_matches(self, result_hits: [] = []) -> list:
def finalize_non_hex_matches(self, result_hits: list = []) -> list:
results: list = []
for start_itr, end_itr in result_hits:
@@ -165,7 +163,7 @@ class Colorize(ColorConverterMixin):
end_itr.forward_chars(21) # Check if best case (255, 255, 255, 0.64)
if end_itr.get_char() == ")":
end_itr.forward_char()
results.append([start, end_itr])
results.append([start_itr, end_itr])
continue
# Break loop if we get back to rgb/rgba/hsl/hsv -> (
@@ -179,7 +177,7 @@ class Colorize(ColorConverterMixin):
return results
def finalize_hex_matches(self, result_hits: [] = []) -> list:
def finalize_hex_matches(self, result_hits: list = []) -> list:
results: list = []
for start_itr, end_itr in result_hits:

View File

@@ -38,7 +38,6 @@ class SearchReplace(Gtk.Grid, SearchReplaceMixin):
self.set_hexpand(True)
self.set_column_spacing(15)
self.set_row_spacing(15)
self.set_row_spacing(15)
self.set_margin_start(15)
self.set_margin_end(15)
@@ -151,7 +150,7 @@ class SearchReplace(Gtk.Grid, SearchReplaceMixin):
find_options += "Regex"
find_options += ", " if self.mode_bttn_box.use_regex else ""
find_options += "Case Sensitive" if self.mode_bttn_box.match_case else "Case Inensitive"
find_options += "Case Sensitive" if self.mode_bttn_box.match_case else "Case Insensitive"
if self.mode_bttn_box.in_selection:
find_options += ", Within Current Selection"