mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-06-29 11:40:38 +00:00
Offers to auto-close blocks with Shift+ENTER
This commit is contained in:
parent
5828206caf
commit
70ea149168
|
@ -191,6 +191,7 @@ TYPE idedbotype
|
|||
END TYPE
|
||||
'--------------------------------------------------------------------------------
|
||||
DIM SHARED idefocusline 'simply stores the location of the line to highlight in red
|
||||
DIM SHARED idecompilererrormessage$
|
||||
DIM SHARED ideautorun
|
||||
DIM SHARED menu$(1 TO 10, 0 TO 20)
|
||||
DIM SHARED menusize(1 TO 10)
|
||||
|
|
|
@ -849,11 +849,12 @@ FUNCTION ide2 (ignore)
|
|||
'scrolling unavailable, but may span multiple lines
|
||||
IF compfailed THEN
|
||||
a$ = MID$(c$, 2, LEN(c$) - 5)
|
||||
|
||||
idecompilererrormessage$ = a$
|
||||
x = 1
|
||||
y = idewy - 3
|
||||
FOR i = 1 TO LEN(a$)
|
||||
IF ASC(a$, i) = 0 THEN
|
||||
idecompilererrormessage$ = LEFT$(a$, i - 1)
|
||||
IF _DEFAULTCOLOR = 7 THEN COLOR 11 ELSE COLOR 7
|
||||
_CONTINUE
|
||||
END IF
|
||||
|
@ -864,7 +865,7 @@ FUNCTION ide2 (ignore)
|
|||
statusarealink = 1
|
||||
ELSE
|
||||
a$ = MID$(c$, 2, LEN(c$) - 5)
|
||||
|
||||
idecompilererrormessage$ = a$
|
||||
|
||||
l = CVL(RIGHT$(c$, 4)): IF l <> 0 THEN idefocusline = l
|
||||
|
||||
|
@ -3541,18 +3542,39 @@ FUNCTION ide2 (ignore)
|
|||
IF K$ = CHR$(13) THEN
|
||||
IF KSHIFT THEN
|
||||
retval$ = ""
|
||||
IF EnteringRGB THEN 'The "Hit Shift+ENTER" message is being shown
|
||||
a$ = idegetline(idecy)
|
||||
IF EnteringRGB THEN 'The "Shift+ENTER" message is being shown
|
||||
oldkeywordHighlight = keywordHighlight
|
||||
keywordHighlight = 0
|
||||
HideBracketHighlight
|
||||
keywordHighlight = oldkeywordHighlight
|
||||
retval$ = idergbmixer$(0)
|
||||
ELSEIF idefocusline > 0 AND LEN(_TRIM$(a$)) = 0 THEN
|
||||
|
||||
'close open block
|
||||
IF idefocusline = definingtypeerror THEN
|
||||
insertAtCursor SCase$("End Type"): GOTO specialchar
|
||||
ELSEIF idefocusline = controlref(controllevel) AND INSTR(idecompilererrormessage$, " without ") > 0 THEN
|
||||
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
|
||||
END IF
|
||||
|
||||
a$ = idegetline(idecy)
|
||||
Found_RGB = 0
|
||||
Found_RGB = Found_RGB + INSTR(UCASE$(a$), "RGB(")
|
||||
Found_RGB = Found_RGB + INSTR(UCASE$(a$), "RGB32(")
|
||||
|
@ -8070,7 +8092,7 @@ SUB ideshowtext
|
|||
|
||||
a$ = idegetline(l)
|
||||
link_idecx = 0
|
||||
rgb_idecx = 0
|
||||
shiftEnter_idecx = 0
|
||||
IF l = idecy THEN
|
||||
IF idecx <= LEN(a$) AND idecx >= 1 THEN
|
||||
cc = ASC(a$, idecx)
|
||||
|
@ -8150,8 +8172,8 @@ SUB ideshowtext
|
|||
RIGHT$(a2$, 6) = "RGB32(" OR _
|
||||
RIGHT$(a2$, 5) = "RGBA(" OR _
|
||||
RIGHT$(a2$, 7) = "RGBA32(") AND qb64prefix_set = 1) THEN
|
||||
rgb_idecx = LEN(a$)
|
||||
a$ = a$ + " --> Hit Shift+ENTER to open the RGB mixer"
|
||||
shiftEnter_idecx = LEN(a$)
|
||||
a$ = a$ + " --> Shift+ENTER to open the RGB mixer"
|
||||
EnteringRGB = -1
|
||||
END IF
|
||||
ELSEIF idecx_comment + idecx_quote = 0 THEN
|
||||
|
@ -8177,6 +8199,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 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))
|
||||
|
@ -8320,8 +8358,8 @@ SUB ideshowtext
|
|||
|
||||
SkipSyntaxHighlighter:
|
||||
|
||||
IF l = idecy AND ((link_idecx > 0 AND m > link_idecx) OR _
|
||||
(rgb_idecx > 0 AND m > rgb_idecx)) THEN COLOR 10
|
||||
IF l = idecy AND (link_idecx > 0 AND m > link_idecx) THEN COLOR 10
|
||||
IF (shiftEnter_idecx > 0 AND m > shiftEnter_idecx) THEN COLOR 10
|
||||
|
||||
IF l = idecy AND (m = bracket1 OR m = bracket2) THEN
|
||||
COLOR , 5
|
||||
|
|
|
@ -764,7 +764,7 @@ DIM SHARED findidsecondarg AS STRING
|
|||
DIM SHARED findanotherid AS INTEGER
|
||||
DIM SHARED findidinternal AS LONG
|
||||
DIM SHARED currentid AS LONG 'is the index of the last ID accessed
|
||||
DIM SHARED linenumber AS LONG, reallinenumber AS LONG, totallinenumber AS LONG
|
||||
DIM SHARED linenumber AS LONG, reallinenumber AS LONG, totallinenumber AS LONG, definingtypeerror AS LONG
|
||||
DIM SHARED wholeline AS STRING
|
||||
DIM SHARED linefragment AS STRING
|
||||
'COMMON SHARED bitmask() AS _INTEGER64
|
||||
|
@ -852,8 +852,8 @@ DIM SHARED everycasenewcase AS LONG
|
|||
|
||||
|
||||
|
||||
DIM controllevel AS INTEGER '0=not in a control block
|
||||
DIM controltype(1000) AS INTEGER
|
||||
DIM SHARED controllevel AS INTEGER '0=not in a control block
|
||||
DIM SHARED controltype(1000) AS INTEGER
|
||||
'1=IF (awaiting END IF)
|
||||
'2=FOR (awaiting NEXT)
|
||||
'3=DO (awaiting LOOP [UNTIL|WHILE param])
|
||||
|
@ -874,7 +874,7 @@ DIM controltype(1000) AS INTEGER
|
|||
DIM controlid(1000) AS LONG
|
||||
DIM controlvalue(1000) AS LONG
|
||||
DIM controlstate(1000) AS INTEGER
|
||||
DIM controlref(1000) AS LONG 'the line number the control was created on
|
||||
DIM SHARED controlref(1000) AS LONG 'the line number the control was created on
|
||||
|
||||
|
||||
|
||||
|
@ -1376,6 +1376,7 @@ nextrunlineindex = 1
|
|||
lasttype = 0
|
||||
lasttypeelement = 0
|
||||
definingtype = 0
|
||||
definingtypeerror = 0
|
||||
constlast = -1
|
||||
'constlastshared = -1
|
||||
defdatahandle = 18
|
||||
|
@ -3619,7 +3620,7 @@ DO
|
|||
GOTO finishednonexec
|
||||
END IF
|
||||
|
||||
IF n < 3 THEN 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
|
||||
definingtype = 2
|
||||
IF firstelement$ = "AS" THEN
|
||||
l$ = SCase$("As")
|
||||
|
|
Loading…
Reference in a new issue