Skip to content

Commit 89be80e

Browse files
committed
indenter fixes, closes #1061. probably not "fixed", but much, much less broken.
1 parent f411c31 commit 89be80e

File tree

2 files changed

+534
-384
lines changed

2 files changed

+534
-384
lines changed

RetailCoder.VBE/Settings/ConfigurationLoader.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text;
66
using System.Windows.Forms;
77
using System.Windows.Input;
8+
using Microsoft.Win32;
89
using Rubberduck.Inspections;
910
using Rubberduck.UI;
1011
using Rubberduck.UI.Command;
@@ -205,6 +206,13 @@ public CodeInspectionSetting[] GetDefaultCodeInspections()
205206

206207
public IndenterSettings GetDefaultIndenterSettings()
207208
{
209+
var tabWidth = 4;
210+
var reg = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\VBA\6.0\Common", false) ??
211+
Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\VBA\7.0\Common", false);
212+
if (reg != null)
213+
{
214+
tabWidth = Convert.ToInt32(reg.GetValue("TabWidth") ?? tabWidth);
215+
}
208216
return new IndenterSettings
209217
{
210218
IndentEntireProcedureBody = true,
@@ -222,7 +230,7 @@ public IndenterSettings GetDefaultIndenterSettings()
222230
EnableUndo = true,
223231
EndOfLineCommentStyle = SmartIndenter.EndOfLineCommentStyle.AlignInColumn,
224232
EndOfLineCommentColumnSpaceAlignment = 50,
225-
IndentSpaces = 4
233+
IndentSpaces = tabWidth
226234
};
227235
}
228236
}

0 commit comments

Comments
 (0)