diff --git a/macosx/GroupsPrefsController.h b/macosx/GroupsPrefsController.h
index 7838abf76..dc4277a29 100644
--- a/macosx/GroupsPrefsController.h
+++ b/macosx/GroupsPrefsController.h
@@ -39,6 +39,8 @@
IBOutlet NSWindow * fGroupRulesSheetWindow;
IBOutlet NSPredicateEditor * fRuleEditor;
+
+ IBOutlet NSLayoutConstraint * fRuleEditorHeightConstraint;
}
- (void) addRemoveGroup: (id) sender;
diff --git a/macosx/GroupsPrefsController.m b/macosx/GroupsPrefsController.m
index a5bc2916a..6103ec171 100644
--- a/macosx/GroupsPrefsController.m
+++ b/macosx/GroupsPrefsController.m
@@ -299,12 +299,16 @@
- (void) ruleEditorRowsDidChange: (NSNotification *) notification
{
- const CGFloat heightDifference = [fRuleEditor numberOfRows] * [fRuleEditor rowHeight] - [fRuleEditor frame].size.height;
- NSRect windowFrame = [fRuleEditor window].frame;
- windowFrame.size.height += heightDifference;
- windowFrame.origin.y -= heightDifference;
+ NSScrollView * ruleEditorScrollView = [fRuleEditor enclosingScrollView];
- [fRuleEditor.window setFrame: windowFrame display: YES animate: YES];
+ const CGFloat rowHeight = [fRuleEditor rowHeight];
+ const CGFloat bordersHeight = [ruleEditorScrollView frame].size.height - [ruleEditorScrollView contentSize].height;
+
+ const CGFloat requiredRowCount = [fRuleEditor numberOfRows];
+ const CGFloat maxVisibleRowCount = (long)((NSHeight([[[fRuleEditor window] screen] visibleFrame]) * 2 / 3) / rowHeight);
+
+ [fRuleEditorHeightConstraint setConstant: MIN(requiredRowCount, maxVisibleRowCount) * rowHeight + bordersHeight];
+ [ruleEditorScrollView setHasVerticalScroller: requiredRowCount > maxVisibleRowCount];
}
@end
diff --git a/macosx/da.lproj/GroupRules.xib b/macosx/da.lproj/GroupRules.xib
index 29f7a84d3..ab50c81b9 100644
--- a/macosx/da.lproj/GroupRules.xib
+++ b/macosx/da.lproj/GroupRules.xib
@@ -9,6 +9,7 @@
+
@@ -187,7 +188,7 @@ Gw
-
+
diff --git a/macosx/de.lproj/GroupRules.xib b/macosx/de.lproj/GroupRules.xib
index 11d703f71..1ddbeef94 100644
--- a/macosx/de.lproj/GroupRules.xib
+++ b/macosx/de.lproj/GroupRules.xib
@@ -9,6 +9,7 @@
+
@@ -187,7 +188,7 @@ Gw
-
+
diff --git a/macosx/en.lproj/GroupRules.xib b/macosx/en.lproj/GroupRules.xib
index db461b056..e5068aecd 100644
--- a/macosx/en.lproj/GroupRules.xib
+++ b/macosx/en.lproj/GroupRules.xib
@@ -9,6 +9,7 @@
+
@@ -187,7 +188,7 @@ Gw
-
+
diff --git a/macosx/es.lproj/GroupRules.xib b/macosx/es.lproj/GroupRules.xib
index e0508caa3..3e8497eee 100644
--- a/macosx/es.lproj/GroupRules.xib
+++ b/macosx/es.lproj/GroupRules.xib
@@ -9,6 +9,7 @@
+
@@ -187,7 +188,7 @@ Gw
-
+
diff --git a/macosx/fr.lproj/GroupRules.xib b/macosx/fr.lproj/GroupRules.xib
index bfc13a683..008c45cc7 100644
--- a/macosx/fr.lproj/GroupRules.xib
+++ b/macosx/fr.lproj/GroupRules.xib
@@ -9,6 +9,7 @@
+
@@ -187,7 +188,7 @@ Gw
-
+
diff --git a/macosx/it.lproj/GroupRules.xib b/macosx/it.lproj/GroupRules.xib
index f7bac96c4..4fad29e5e 100644
--- a/macosx/it.lproj/GroupRules.xib
+++ b/macosx/it.lproj/GroupRules.xib
@@ -9,6 +9,7 @@
+
@@ -187,7 +188,7 @@ Gw
-
+
diff --git a/macosx/nl.lproj/GroupRules.xib b/macosx/nl.lproj/GroupRules.xib
index 7360027fd..5989b4378 100644
--- a/macosx/nl.lproj/GroupRules.xib
+++ b/macosx/nl.lproj/GroupRules.xib
@@ -9,6 +9,7 @@
+
@@ -187,7 +188,7 @@ Gw
-
+
diff --git a/macosx/pt_PT.lproj/GroupRules.xib b/macosx/pt_PT.lproj/GroupRules.xib
index fbb31e4fd..6525539cc 100644
--- a/macosx/pt_PT.lproj/GroupRules.xib
+++ b/macosx/pt_PT.lproj/GroupRules.xib
@@ -9,6 +9,7 @@
+
@@ -187,7 +188,7 @@ Gw
-
+
diff --git a/macosx/ru.lproj/GroupRules.xib b/macosx/ru.lproj/GroupRules.xib
index 7b01879eb..c2755d341 100644
--- a/macosx/ru.lproj/GroupRules.xib
+++ b/macosx/ru.lproj/GroupRules.xib
@@ -9,6 +9,7 @@
+
@@ -187,7 +188,7 @@ Gw
-
+
diff --git a/macosx/tr.lproj/GroupRules.xib b/macosx/tr.lproj/GroupRules.xib
index 4ae8b56bf..b39aedb88 100644
--- a/macosx/tr.lproj/GroupRules.xib
+++ b/macosx/tr.lproj/GroupRules.xib
@@ -9,6 +9,7 @@
+
@@ -187,7 +188,7 @@ Gw
-
+