Skip to content

Commit b9db8f4

Browse files
committed
preferences: New pref for applying text filters in folder comparison
New preferences are awful, but this has been a long-standing issue for performance of folder comparisons, and it's often not clear to new users that it's a thing we do. Also, the upcoming newline-ignoring change makes this even more expensive, so now seems like the right time to add this.
1 parent 4dffbf7 commit b9db8f4

3 files changed

Lines changed: 31 additions & 6 deletions

File tree

data/org.gnome.meld.gschema.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@
161161
<summary>File timestamp resolution</summary>
162162
<description>When comparing based on mtime, this is the minimum difference in nanoseconds between two files before they're considered to have different mtimes. This is useful when comparing files between filesystems with different timestamp resolution.</description>
163163
</key>
164+
<key name="folder-filter-text" type="b">
165+
<default>true</default>
166+
<summary>Apply text filters during folder comparisons</summary>
167+
<description>If true, folder comparisons that compare file contents also apply active text filters and the blank line trimming option, and ignore newline differences.</description>
168+
</key>
164169
<key name="folder-status-filters" type="as">
165170
<default>['normal', 'modified', 'new']</default>
166171
<summary>File status filters</summary>

data/ui/preferences.ui

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,22 @@
787787
<property name="position">1</property>
788788
</packing>
789789
</child>
790+
<child>
791+
<object class="GtkCheckButton" id="checkbutton_folder_filter_text">
792+
<property name="label" translatable="yes">Apply text filters during folder comparisons</property>
793+
<property name="visible">True</property>
794+
<property name="can_focus">True</property>
795+
<property name="receives_default">False</property>
796+
<property name="use_underline">True</property>
797+
<property name="xalign">0</property>
798+
<property name="draw_indicator">True</property>
799+
</object>
800+
<packing>
801+
<property name="expand">False</property>
802+
<property name="fill">False</property>
803+
<property name="position">2</property>
804+
</packing>
805+
</child>
790806
</object>
791807
<packing>
792808
<property name="expand">False</property>

meld/preferences.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def __init__(self, parent):
199199
('use-system-editor', self.system_editor_checkbutton, 'active'),
200200
('custom-editor-command', self.custom_edit_command_entry, 'text'),
201201
('folder-shallow-comparison', self.checkbutton_shallow_compare, 'active'),
202+
('folder-filter-text', self.checkbutton_folder_filter_text, 'active'),
202203
('folder-ignore-symlinks', self.checkbutton_ignore_symlinks, 'active'),
203204
('vc-show-commit-margin', self.checkbutton_show_commit_margin, 'active'),
204205
('vc-commit-margin', self.spinbutton_commit_margin, 'value'),
@@ -212,12 +213,15 @@ def __init__(self, parent):
212213
for key, obj, attribute in bindings:
213214
settings.bind(key, obj, attribute, Gio.SettingsBindFlags.DEFAULT)
214215

215-
settings.bind(
216-
'use-system-editor', self.custom_edit_command_entry, 'sensitive',
217-
Gio.SettingsBindFlags.DEFAULT | Gio.SettingsBindFlags.INVERT_BOOLEAN)
218-
settings.bind(
219-
'use-system-font', self.fontpicker, 'sensitive',
220-
Gio.SettingsBindFlags.DEFAULT | Gio.SettingsBindFlags.INVERT_BOOLEAN)
216+
invert_bindings = [
217+
('use-system-editor', self.custom_edit_command_entry, 'sensitive'),
218+
('use-system-font', self.fontpicker, 'sensitive'),
219+
('folder-shallow-comparison', self.checkbutton_folder_filter_text, 'sensitive'),
220+
]
221+
for key, obj, attribute in invert_bindings:
222+
settings.bind(
223+
key, obj, attribute, Gio.SettingsBindFlags.DEFAULT |
224+
Gio.SettingsBindFlags.INVERT_BOOLEAN)
221225

222226
self.checkbutton_wrap_text.bind_property(
223227
'active', self.checkbutton_wrap_word, 'sensitive',

0 commit comments

Comments
 (0)