Skip to content

Commit 09c0907

Browse files
committed
added xaml binding for min/max values, cleaned up SCP
1 parent 8513b48 commit 09c0907

File tree

4 files changed

+22
-19
lines changed

4 files changed

+22
-19
lines changed

Rubberduck.Core/AutoComplete/Service/SelfClosingPair.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ namespace Rubberduck.AutoComplete.Service
55
{
66
public class SelfClosingPair : IEquatable<SelfClosingPair>
77
{
8-
[Flags]
9-
public enum MatchType
10-
{
11-
NoMatch = 0,
12-
OpeningCharacterMatch = 1,
13-
ClosingCharacterMatch = 2,
14-
}
15-
168
public SelfClosingPair(char opening, char closing)
179
{
1810
OpeningChar = opening;

Rubberduck.Core/Settings/AutoCompleteSettings.cs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
using Rubberduck.AutoComplete;
2-
using System;
3-
using System.Collections.Generic;
1+
using System;
42
using System.Configuration;
5-
using System.Linq;
63
using System.Xml.Serialization;
74

85
namespace Rubberduck.Settings
@@ -27,6 +24,15 @@ public interface IAutoCompleteSettings
2724
[XmlType(AnonymousType = true)]
2825
public class AutoCompleteSettings : IAutoCompleteSettings, IEquatable<AutoCompleteSettings>
2926
{
27+
/// <summary>
28+
/// Less than that would be useless (wouldn't concat).
29+
/// </summary>
30+
public static readonly int ConcatMaxLinesMinValue = 2;
31+
/// <summary>
32+
/// /More than that would be illegal (wouldn't compile).
33+
/// </summary>
34+
public static readonly int ConcatMaxLinesMaxValue = 25;
35+
3036
public static AutoCompleteSettings AllEnabled =>
3137
new AutoCompleteSettings
3238
{
@@ -58,7 +64,6 @@ public AutoCompleteSettings()
5864
public class SmartConcatSettings : IEquatable<SmartConcatSettings>
5965
{
6066
private int _maxLogicalLineLineCount;
61-
private const int MaximumLines = 25; // more than that wouldn't compile
6267

6368
[XmlAttribute]
6469
public bool IsEnabled { get; set; }
@@ -69,15 +74,15 @@ public int MaxLogicalLineLineCount
6974
get => _maxLogicalLineLineCount;
7075
set
7176
{
72-
if (value > MaximumLines)
77+
if (value > ConcatMaxLinesMaxValue)
7378
{
74-
value = MaximumLines;
79+
value = ConcatMaxLinesMaxValue;
7580
}
76-
77-
if (value < 5)
81+
else if (value < ConcatMaxLinesMinValue)
7882
{
79-
value = 5; // completely arbitrary magical value.
83+
value = ConcatMaxLinesMinValue;
8084
}
85+
8186
_maxLogicalLineLineCount = value;
8287
}
8388
}

Rubberduck.Core/UI/Settings/AutoCompleteSettings.xaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@
112112
Content="{Resx ResxName=Rubberduck.Resources.Settings.AutoCompletesPage, Key=ConcatVbNewLine}" />
113113

114114
<Label Margin="15,0,15,0" Content="{Resx ResxName=Rubberduck.Resources.Settings.AutoCompletesPage, Key=ConcatMaxLines}" />
115-
<controls:NumberPicker Margin="15,0,15,0" NumValue="{Binding ConcatMaxLines}" />
115+
<controls:NumberPicker Margin="15,0,15,0"
116+
NumValue="{Binding ConcatMaxLines}"
117+
MinNumber="{Binding ConcatMaxLinesMinValue}"
118+
MaxNumber="{Binding ConcatMaxLinesMaxValue}"/>
116119

117120
<Label Margin="10"
118121
Content="{Resx ResxName=Rubberduck.Resources.Settings.AutoCompletesPage, Key=BlockCompletion}"

Rubberduck.Core/UI/Settings/AutoCompleteSettingsViewModel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ public int ConcatMaxLines
123123
}
124124
}
125125

126+
public int ConcatMaxLinesMinValue => Rubberduck.Settings.AutoCompleteSettings.ConcatMaxLinesMinValue;
127+
public int ConcatMaxLinesMaxValue => Rubberduck.Settings.AutoCompleteSettings.ConcatMaxLinesMaxValue;
128+
126129
private bool _enableBlockCompletion;
127130

128131
public bool EnableBlockCompletion

0 commit comments

Comments
 (0)