From 0db73ad0711ab4da5c48cb39f1b98c5126e5103a Mon Sep 17 00:00:00 2001 From: SteveMcNeill Date: Thu, 20 Aug 2015 11:13:25 -0400 Subject: [PATCH] Fix to config.txt file error catching for auto indent spacing --- source/global/IDEsettings.bas | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/source/global/IDEsettings.bas b/source/global/IDEsettings.bas index ea1ef2457..d30b9073b 100644 --- a/source/global/IDEsettings.bas +++ b/source/global/IDEsettings.bas @@ -7,18 +7,18 @@ DIM SHARED LoadedIDESettings AS INTEGER DIM SHARED MouseButtonSwapped AS _BYTE IF LoadedIDESettings = 0 THEN - 'We only want to load the file once when QB64 first starts - 'Other changes should occur to our settings when we change them in their appropiate routines. - 'There's no reason to open and close and open and close the same file a million times. + 'We only want to load the file once when QB64 first starts + 'Other changes should occur to our settings when we change them in their appropiate routines. + 'There's no reason to open and close and open and close the same file a million times. - LoadedIDESettings = -1 + LoadedIDESettings = -1 - ConfigFile$ = "internal/config.txt" - ConfigBak$ = "internal/config.bak" + ConfigFile$ = "internal/config.txt" + ConfigBak$ = "internal/config.bak" - GOSUB CheckConfigFileExists 'make certain the config file exists and if not, create one + GOSUB CheckConfigFileExists 'make certain the config file exists and if not, create one - IF INSTR(_OS$, "WIN") THEN + IF INSTR(_OS$, "WIN") THEN result = ReadConfigSetting("AllowIndependentSettings", value$) IF result THEN @@ -181,12 +181,9 @@ IF LoadedIDESettings = 0 THEN result = ReadConfigSetting("IDE_IndentSize", value$) ideautoindentsize = VAL(value$) - if result = 0 then + if ideautoindentsize < 1 OR ideautoindentsize > 64 then ideautoindentsize = 4 WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_IndentSize", "4" - else - IF ideautoindentsize < 0 OR ideautoindentsize > 64 THEN ideautoindentsize = 4 - WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_IndentSize", "4" end if result = ReadConfigSetting("IDE_CustomFont", value$)