From 1c5711f15e182b216f7bbeea38f60ec45fa1d9c7 Mon Sep 17 00:00:00 2001 From: Fellippe Heitor Date: Mon, 8 Feb 2021 10:58:02 -0300 Subject: [PATCH] Retreats 'shift+enter to close block'. Until a more efficient approach comes up, at least. --- source/global/IDEsettings.bas | 24 +++---- source/ide/ide_global.bas | 2 +- source/ide/ide_methods.bas | 122 +++++++++++++++++----------------- source/qb64.bas | 3 +- 4 files changed, 76 insertions(+), 75 deletions(-) diff --git a/source/global/IDEsettings.bas b/source/global/IDEsettings.bas index 725e8171a..d400b1eb5 100644 --- a/source/global/IDEsettings.bas +++ b/source/global/IDEsettings.bas @@ -14,7 +14,7 @@ DIM SHARED ShowLineNumbersSeparator AS _BYTE, ShowLineNumbersUseBG AS _BYTE DIM SHARED IgnoreWarnings AS _BYTE, qb64versionprinted AS _BYTE DIM SHARED DisableSyntaxHighlighter AS _BYTE, ExeToSourceFolderFirstTimeMsg AS _BYTE DIM SHARED WhiteListQB64FirstTimeMsg AS _BYTE, ideautolayoutkwcapitals AS _BYTE -DIM SHARED IdeAutoComplete AS _BYTE +'DIM SHARED IdeAutoComplete AS _BYTE DIM SHARED windowSettingsSection$, colorSettingsSection$, customDictionarySection$ DIM SHARED mouseSettingsSection$, generalSettingsSection$, displaySettingsSection$ DIM SHARED colorSchemesSection$, iniFolderIndex$, DebugInfoIniWarning$, ConfigFile$ @@ -202,17 +202,17 @@ ELSE WriteConfigSetting generalSettingsSection$, "IgnoreWarnings", "False" END IF -IF ReadConfigSetting(generalSettingsSection$, "IdeAutoComplete", value$) THEN - IF UCASE$(value$) = "TRUE" OR ABS(VAL(value$)) = 1 THEN - IdeAutoComplete = -1 - ELSE - IdeAutoComplete = 0 - WriteConfigSetting generalSettingsSection$, "IdeAutoComplete", "False" - END IF -ELSE - IdeAutoComplete = -1 - WriteConfigSetting generalSettingsSection$, "IdeAutoComplete", "True" -END IF +'IF ReadConfigSetting(generalSettingsSection$, "IdeAutoComplete", value$) THEN +' IF UCASE$(value$) = "TRUE" OR ABS(VAL(value$)) = 1 THEN +' IdeAutoComplete = -1 +' ELSE +' IdeAutoComplete = 0 +' WriteConfigSetting generalSettingsSection$, "IdeAutoComplete", "False" +' END IF +'ELSE +' IdeAutoComplete = -1 +' WriteConfigSetting generalSettingsSection$, "IdeAutoComplete", "True" +'END IF result = ReadConfigSetting(generalSettingsSection$, "BackupSize", value$) idebackupsize = VAL(value$) diff --git a/source/ide/ide_global.bas b/source/ide/ide_global.bas index 630554a64..2f3c124b2 100644 --- a/source/ide/ide_global.bas +++ b/source/ide/ide_global.bas @@ -200,7 +200,7 @@ DIM SHARED menus AS INTEGER, idecontextualmenuID AS INTEGER DIM SHARED ideeditmenuID AS INTEGER, SearchMenuID AS INTEGER DIM SHARED OptionsMenuID AS INTEGER, OptionsMenuSwapMouse AS INTEGER, OptionsMenuPasteCursor AS INTEGER DIM SHARED OptionsMenuShowErrorsImmediately AS INTEGER, OptionsMenuIgnoreWarnings AS INTEGER -DIM SHARED OptionsMenuDisableSyntax AS INTEGER, OptionsMenuAutoComplete +DIM SHARED OptionsMenuDisableSyntax AS INTEGER ', OptionsMenuAutoComplete DIM SHARED ViewMenuID AS INTEGER, ViewMenuShowLineNumbersSubMenuID AS INTEGER DIM SHARED ViewMenuShowSeparatorID AS INTEGER, ViewMenuShowBGID AS INTEGER DIM SHARED ViewMenuCompilerWarnings AS INTEGER diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 480823e7c..6f9ca1f21 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -379,11 +379,10 @@ FUNCTION ide2 (ignore) menuDesc$(m, i - 1) = "Toggles display of warning messages (unused variables, etc)" IF IgnoreWarnings THEN menu$(OptionsMenuID, OptionsMenuIgnoreWarnings) = CHR$(7) + "Ignore #Warnings" - OptionsMenuAutoComplete = i - menu$(m, i) = "Code Suggest#ions": i = i + 1 - menuDesc$(m, i - 1) = "Toggles code suggestions/auto-complete" - IF IdeAutoComplete THEN menu$(OptionsMenuID, OptionsMenuAutoComplete) = CHR$(7) + "Code Suggest#ions" - + 'OptionsMenuAutoComplete = i + 'menu$(m, i) = "Code Suggest#ions": i = i + 1 + 'menuDesc$(m, i - 1) = "Toggles code suggestions/auto-complete" + 'IF IdeAutoComplete THEN menu$(OptionsMenuID, OptionsMenuAutoComplete) = CHR$(7) + "Code Suggest#ions" menusize(m) = i - 1 @@ -3588,30 +3587,30 @@ FUNCTION ide2 (ignore) HideBracketHighlight keywordHighlight = oldkeywordHighlight retval$ = idergbmixer$(0) - ELSEIF IdeAutoComplete AND idefocusline > 0 AND LEN(_TRIM$(a$)) = 0 THEN - 'close open block - tempIndent$ = idegetline(idefocusline) - tempIndent$ = SPACE$(LEN(tempIndent$) - LEN(LTRIM$(tempindent$))) - IF idefocusline = definingtypeerror THEN - idecx = LEN(tempIndent$) + 1 - insertAtCursor SCase$("End Type"): GOTO specialchar - ELSEIF idefocusline = controlref(controllevel) AND INSTR(idecompilererrormessage$, " without ") > 0 THEN - idecx = LEN(tempIndent$) + 1 - SELECT EVERYCASE controltype(controllevel) - CASE 1: insertAtCursor SCase$("End If"): GOTO specialchar - CASE 2: insertAtCursor SCase$("Next"): GOTO specialchar - CASE 3, 4: insertAtCursor SCase$("Loop"): GOTO specialchar - CASE 5: insertAtCursor SCase$("Wend"): GOTO specialchar - CASE 6: insertAtCursor SCase$("$End If"): GOTO specialchar - CASE 10 TO 19: insertAtCursor SCase$("End Select"): GOTO specialchar - CASE 32 - IF LEFT$(subfunc, 4) = "SUB_" THEN - insertAtCursor SCase$("End Sub"): GOTO specialchar - ELSE - insertAtCursor SCase$("End Function"): GOTO specialchar - END IF - END SELECT - END IF + 'ELSEIF IdeAutoComplete AND idefocusline > 0 AND LEN(_TRIM$(a$)) = 0 THEN + ' 'close open block + ' tempIndent$ = idegetline(idefocusline) + ' tempIndent$ = SPACE$(LEN(tempIndent$) - LEN(LTRIM$(tempindent$))) + ' IF idefocusline = definingtypeerror THEN + ' idecx = LEN(tempIndent$) + 1 + ' insertAtCursor SCase$("End Type"): GOTO specialchar + ' ELSEIF idefocusline = controlref(controllevel) AND INSTR(idecompilererrormessage$, " without ") > 0 THEN + ' idecx = LEN(tempIndent$) + 1 + ' SELECT EVERYCASE controltype(controllevel) + ' CASE 1: insertAtCursor SCase$("End If"): GOTO specialchar + ' CASE 2: insertAtCursor SCase$("Next"): GOTO specialchar + ' CASE 3, 4: insertAtCursor SCase$("Loop"): GOTO specialchar + ' CASE 5: insertAtCursor SCase$("Wend"): GOTO specialchar + ' CASE 6: insertAtCursor SCase$("$End If"): GOTO specialchar + ' CASE 10 TO 19: insertAtCursor SCase$("End Select"): GOTO specialchar + ' CASE 32 + ' IF LEFT$(subfunc, 4) = "SUB_" THEN + ' insertAtCursor SCase$("End Sub"): GOTO specialchar + ' ELSE + ' insertAtCursor SCase$("End Function"): GOTO specialchar + ' END IF + ' END SELECT + ' END IF ELSE IF ideselect THEN IF ideselecty1 <> idecy THEN GOTO specialchar 'multi line selected @@ -4779,21 +4778,21 @@ FUNCTION ide2 (ignore) GOTO ideloop END IF - IF RIGHT$(menu$(m, s), 17) = "Code Suggest#ions" THEN - PCOPY 2, 0 - IF IdeAutoComplete = 0 THEN - IdeAutoComplete = -1 - WriteConfigSetting generalSettingsSection$, "IdeAutoComplete", "True" - menu$(OptionsMenuID, OptionsMenuAutoComplete) = CHR$(7) + "Code Suggest#ions" - ELSE - IdeAutoComplete = 0 - WriteConfigSetting generalSettingsSection$, "IdeAutoComplete", "False" - menu$(OptionsMenuID, OptionsMenuAutoComplete) = "Code Suggest#ions" - END IF - idechangemade = 1 - PCOPY 3, 0: SCREEN , , 3, 0 - GOTO ideloop - END IF + 'IF RIGHT$(menu$(m, s), 17) = "Code Suggest#ions" THEN + ' PCOPY 2, 0 + ' IF IdeAutoComplete = 0 THEN + ' IdeAutoComplete = -1 + ' WriteConfigSetting generalSettingsSection$, "IdeAutoComplete", "True" + ' menu$(OptionsMenuID, OptionsMenuAutoComplete) = CHR$(7) + "Code Suggest#ions" + ' ELSE + ' IdeAutoComplete = 0 + ' WriteConfigSetting generalSettingsSection$, "IdeAutoComplete", "False" + ' menu$(OptionsMenuID, OptionsMenuAutoComplete) = "Code Suggest#ions" + ' END IF + ' idechangemade = 1 + ' PCOPY 3, 0: SCREEN , , 3, 0 + ' GOTO ideloop + 'END IF IF RIGHT$(menu$(m, s), 28) = "Output EXE to Source #Folder" THEN PCOPY 2, 0 @@ -8224,7 +8223,8 @@ SUB ideshowtext 'an _RGB(, _RGB32(, _RGBA( or _RGBA32(, we'll offer the RGB 'color mixer. a2$ = UCASE$(a$) - IF IdeAutoComplete AND idecx = LEN(a$) + 1 AND idecx_comment + idecx_quote = 0 THEN + 'IF IdeAutoComplete AND idecx = LEN(a$) + 1 AND idecx_comment + idecx_quote = 0 THEN + IF idecx = LEN(a$) + 1 AND idecx_comment + idecx_quote = 0 THEN IF (RIGHT$(a2$, 5) = "_RGB(" OR _ RIGHT$(a2$, 7) = "_RGB32(" OR _ RIGHT$(a2$, 6) = "_RGBA(" OR _ @@ -8260,22 +8260,22 @@ SUB ideshowtext f$ = p$ + ActiveINCLUDELinkFile IF _FILEEXISTS(f$) THEN a$ = a$ + " --> Double-click to open": ActiveINCLUDELink = idecy END IF - ELSE - temp_a$ = idegetline(idecy) - IF IdeAutoComplete AND idefocusline = l AND LEN(_TRIM$(temp_a$)) = 0 THEN - 'some errors are mere blocks the user just opened and is still - 'working on. This bit will offer to close said blocks. - IF idefocusline = definingtypeerror THEN - shiftEnter_idecx = LEN(a$) - a$ = a$ + " --> Shift+ENTER to close block" - ELSEIF idefocusline = controlref(controllevel) AND INSTR(idecompilererrormessage$, " without ") > 0 THEN - SELECT EVERYCASE controltype(controllevel) - CASE 1 to 6,10 to 19,32 - shiftEnter_idecx = LEN(a$) - a$ = a$ + " --> Shift+ENTER to close block" - END SELECT - END IF - END IF + 'ELSE + ' temp_a$ = idegetline(idecy) + ' IF IdeAutoComplete AND idefocusline = l AND LEN(_TRIM$(temp_a$)) = 0 THEN + ' 'some errors are mere blocks the user just opened and is still + ' 'working on. This bit will offer to close said blocks. + ' IF idefocusline = definingtypeerror THEN + ' shiftEnter_idecx = LEN(a$) + ' a$ = a$ + " --> Shift+ENTER to close block" + ' ELSEIF idefocusline = controlref(controllevel) AND INSTR(idecompilererrormessage$, " without ") > 0 THEN + ' SELECT EVERYCASE controltype(controllevel) + ' CASE 1 to 6,10 to 19,32 + ' shiftEnter_idecx = LEN(a$) + ' a$ = a$ + " --> Shift+ENTER to close block" + ' END SELECT + ' END IF + ' END IF END IF 'l = idecy a2$ = SPACE$(idesx + (idewx - 3)) diff --git a/source/qb64.bas b/source/qb64.bas index 9b5da2357..84152b2c2 100644 --- a/source/qb64.bas +++ b/source/qb64.bas @@ -3621,7 +3621,8 @@ DO GOTO finishednonexec END IF - IF n < 3 THEN definingtypeerror = linenumber: a$ = "Expected element-name AS type or AS type element-list": GOTO errmes + 'IF n < 3 THEN definingtypeerror = linenumber: a$ = "Expected element-name AS type or AS type element-list": GOTO errmes + IF n < 3 THEN a$ = "Expected element-name AS type or AS type element-list": GOTO errmes definingtype = 2 IF firstelement$ = "AS" THEN l$ = SCase$("As")