Preserve case sensitivity state in config file on state change

This commit is contained in:
Joe Peled 2020-10-17 17:51:19 -04:00
parent 80b20a8050
commit 66f4020e37
2 changed files with 8 additions and 1 deletions

View File

@ -122,6 +122,7 @@ DEFAULTS = {
'putty_paste_style_source_clipboard': False, 'putty_paste_style_source_clipboard': False,
'smart_copy' : True, 'smart_copy' : True,
'line_height' : 1.0, 'line_height' : 1.0,
'case_sensitive' : True,
}, },
'keybindings': { 'keybindings': {
'zoom_in' : '<Control>plus', 'zoom_in' : '<Control>plus',

View File

@ -84,8 +84,12 @@ class Searchbar(Gtk.HBox):
# Match Case checkbox # Match Case checkbox
self.match_case = Gtk.CheckButton.new_with_label('Match Case') self.match_case = Gtk.CheckButton.new_with_label('Match Case')
self.match_case.show() self.match_case.show()
if self.config.base.get_item('case_sensitive') is True:
case_sensitive = True
else:
case_sensitive = False
self.match_case.set_sensitive(True) self.match_case.set_sensitive(True)
self.match_case.set_active(True) self.match_case.set_active(case_sensitive)
self.match_case.connect('toggled', self.match_case_toggled) self.match_case.connect('toggled', self.match_case_toggled)
# Wrap checkbox # Wrap checkbox
@ -132,6 +136,8 @@ class Searchbar(Gtk.HBox):
self.regex_flags_pcre2 = regex.FLAGS_PCRE2 self.regex_flags_pcre2 = regex.FLAGS_PCRE2
self.regex_flags_glib = regex.FLAGS_GLIB self.regex_flags_glib = regex.FLAGS_GLIB
self.config.base.set_item('case_sensitive', toggled_state)
self.config.save()
self.do_search(self.entry) # Start a new search everytime the check box is toggled. self.do_search(self.entry) # Start a new search everytime the check box is toggled.
def get_vte(self): def get_vte(self):