mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-06-29 10:30:36 +00:00
Adds word-wrapping to status area error messages.
This commit is contained in:
parent
0f82c6320f
commit
56a61321d1
|
@ -1008,59 +1008,42 @@ FUNCTION ide2 (ignore)
|
||||||
'scrolling unavailable, but may span multiple lines
|
'scrolling unavailable, but may span multiple lines
|
||||||
IF compfailed THEN
|
IF compfailed THEN
|
||||||
a$ = MID$(c$, 2, LEN(c$) - 5)
|
a$ = MID$(c$, 2, LEN(c$) - 5)
|
||||||
idecompilererrormessage$ = a$
|
x = 2
|
||||||
x = 1
|
|
||||||
y = idewy - 3
|
y = idewy - 3
|
||||||
FOR i = 1 TO LEN(a$)
|
printWrapStatus x, y, x, a$
|
||||||
IF ASC(a$, i) = 0 THEN
|
|
||||||
idecompilererrormessage$ = LEFT$(a$, i - 1)
|
|
||||||
IF _DEFAULTCOLOR <> 11 THEN COLOR 11 ELSE COLOR 7
|
|
||||||
_CONTINUE
|
|
||||||
END IF
|
|
||||||
x = x + 1: IF x = idewx THEN x = 2: y = y + 1
|
|
||||||
IF y > idewy - 1 THEN EXIT FOR
|
|
||||||
_PRINTSTRING (x, y), CHR$(ASC(a$, i))
|
|
||||||
NEXT
|
|
||||||
statusarealink = 1
|
statusarealink = 1
|
||||||
ELSE
|
ELSE
|
||||||
a$ = MID$(c$, 2, LEN(c$) - 5)
|
a$ = MID$(c$, 2, LEN(c$) - 5)
|
||||||
idecompilererrormessage$ = a$
|
|
||||||
|
|
||||||
l = CVL(RIGHT$(c$, 4)): IF l <> 0 THEN idefocusline = l
|
l = CVL(RIGHT$(c$, 4)): IF l <> 0 THEN idefocusline = l
|
||||||
|
|
||||||
x = 1
|
x = 2
|
||||||
y = idewy - 3
|
y = idewy - 3
|
||||||
|
|
||||||
IF l <> 0 AND idecy = l THEN onCurrentLine = LEN(a$): a$ = a$ + " on current line"
|
IF l <> 0 AND idecy = l THEN onCurrentLine = LEN(a$): a$ = a$ + CHR$(1) + " on current line"
|
||||||
|
|
||||||
hasReference = INSTR(a$, " - Reference: ")
|
hasReference = INSTR(a$, " - Reference: ")
|
||||||
IF hasReference THEN
|
IF hasReference THEN
|
||||||
hasReference = hasReference + 14
|
hasReference = hasReference + 13
|
||||||
|
a$ = LEFT$(a$, hasReference) + CHR$(2) + MID$(a$, hasReference + 1)
|
||||||
ELSE
|
ELSE
|
||||||
hasReference = INSTR(a$, "Expected ")
|
hasReference = INSTR(a$, "Expected ")
|
||||||
IF hasReference THEN
|
IF hasReference THEN
|
||||||
hasReference = hasReference + 9
|
hasReference = hasReference + 8
|
||||||
|
a$ = LEFT$(a$, hasReference) + CHR$(2) + MID$(a$, hasReference + 1)
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
FOR i = 1 TO LEN(a$)
|
|
||||||
IF hasReference > 0 AND i >= hasReference THEN COLOR 12, 6
|
printWrapStatus x, y, x, a$
|
||||||
IF onCurrentLine > 0 AND i > onCurrentLine THEN COLOR 7, 1
|
|
||||||
x = x + 1: IF x = idewx THEN x = 2: y = y + 1
|
|
||||||
IF y > idewy - 1 THEN EXIT FOR
|
|
||||||
_PRINTSTRING (x, y), CHR$(ASC(a$, i))
|
|
||||||
NEXT
|
|
||||||
|
|
||||||
IF l <> 0 AND idecy <> l THEN
|
IF l <> 0 AND idecy <> l THEN
|
||||||
a$ = " on line" + STR$(l) + " (click here or Ctrl+Shift+G to jump there)"
|
a$ = " on line" + STR$(l) + " (click here or Ctrl+Shift+G to jump there)"
|
||||||
COLOR 11, 1
|
COLOR 11, 1
|
||||||
FOR i = 1 TO LEN(a$)
|
printWrapStatus POS(0), CSRLIN, 2, a$
|
||||||
x = x + 1: IF x = idewx THEN x = 2: y = y + 1
|
|
||||||
IF y > idewy - 1 THEN EXIT FOR
|
|
||||||
_PRINTSTRING (x, y), CHR$(ASC(a$, i))
|
|
||||||
NEXT
|
|
||||||
statusarealink = 2
|
statusarealink = 2
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
y = POS(0)
|
||||||
IF y < idewy - 1 AND linefragment <> "[INFORMATION UNAVAILABLE]" THEN
|
IF y < idewy - 1 AND linefragment <> "[INFORMATION UNAVAILABLE]" THEN
|
||||||
temp$ = linefragment
|
temp$ = linefragment
|
||||||
FOR i = 1 TO LEN(temp$)
|
FOR i = 1 TO LEN(temp$)
|
||||||
|
@ -17167,3 +17150,69 @@ SUB purgeprecompiledcontent
|
||||||
END IF
|
END IF
|
||||||
idechangemade = 1 'force recompilation
|
idechangemade = 1 'force recompilation
|
||||||
END SUB
|
END SUB
|
||||||
|
|
||||||
|
SUB printWrapStatus (x AS INTEGER, y AS INTEGER, initialX AS INTEGER, __text$)
|
||||||
|
DIM text$, nextWord$
|
||||||
|
DIM AS INTEGER i, findSep, findColorMarker, changeColor, changeColorAfter
|
||||||
|
text$ = __text$
|
||||||
|
|
||||||
|
LOCATE y, x
|
||||||
|
DO WHILE LEN(_TRIM$(text$))
|
||||||
|
findSep = INSTR(text$, " ")
|
||||||
|
IF findSep THEN
|
||||||
|
nextWord$ = LEFT$(text$, findSep)
|
||||||
|
ELSE
|
||||||
|
findSep = LEN(text$)
|
||||||
|
nextWord$ = text$
|
||||||
|
END IF
|
||||||
|
text$ = MID$(text$, findSep + 1)
|
||||||
|
IF POS(0) + LEN(nextWord$) > _WIDTH THEN
|
||||||
|
IF CSRLIN + 1 <= (idewy - 4) + 3 THEN
|
||||||
|
LOCATE CSRLIN + 1, initialX
|
||||||
|
ELSE
|
||||||
|
'no more room for printing
|
||||||
|
EXIT SUB
|
||||||
|
END IF
|
||||||
|
END IF
|
||||||
|
|
||||||
|
changeColor = 0
|
||||||
|
changeColorAfter = 0
|
||||||
|
skipSpace = 0
|
||||||
|
FOR i = 0 TO 2
|
||||||
|
findColorMarker = INSTR(nextWord$, CHR$(i))
|
||||||
|
IF findColorMarker = 1 THEN
|
||||||
|
nextWord$ = MID$(nextWord$, 2)
|
||||||
|
changeColor = i + 1
|
||||||
|
GOSUB applyColorChange
|
||||||
|
ELSEIF findColorMarker > 0 THEN
|
||||||
|
nextWord$ = LEFT$(nextWord$, findColorMarker - 1) + MID$(nextWord$, findColorMarker + 1)
|
||||||
|
IF RIGHT$(nextWord$, 1) = " " THEN
|
||||||
|
nextWord$ = RTRIM$(nextWord$)
|
||||||
|
skipSpace = -1
|
||||||
|
END IF
|
||||||
|
changeColorAfter = i + 1
|
||||||
|
END IF
|
||||||
|
NEXT
|
||||||
|
|
||||||
|
PRINT nextWord$;
|
||||||
|
|
||||||
|
IF changeColorAfter THEN
|
||||||
|
changeColor = changeColorAfter
|
||||||
|
GOSUB applyColorChange
|
||||||
|
IF skipSpace THEN LOCATE , POS(0) + 1
|
||||||
|
END IF
|
||||||
|
LOOP
|
||||||
|
EXIT SUB
|
||||||
|
|
||||||
|
applyColorChange:
|
||||||
|
SELECT EVERYCASE changeColor
|
||||||
|
CASE 1
|
||||||
|
IF _DEFAULTCOLOR <> 11 THEN COLOR 11 ELSE COLOR 7
|
||||||
|
CASE 2
|
||||||
|
COLOR 7, 1
|
||||||
|
CASE 3
|
||||||
|
COLOR 12, 6
|
||||||
|
END SELECT
|
||||||
|
RETURN
|
||||||
|
END SUB
|
||||||
|
|
||||||
|
|
|
@ -13195,7 +13195,7 @@ END IF
|
||||||
|
|
||||||
IF compfailed THEN
|
IF compfailed THEN
|
||||||
IF idemode THEN
|
IF idemode THEN
|
||||||
idemessage$ = "C++ Compilation failed (Check " + CHR$(0) + compilelog$ + CHR$(0) + ")"
|
idemessage$ = "C++ Compilation failed " + CHR$(0) + "(Check " + _TRIM$(compilelog$) + ")"
|
||||||
GOTO ideerror
|
GOTO ideerror
|
||||||
END IF
|
END IF
|
||||||
IF compfailed THEN
|
IF compfailed THEN
|
||||||
|
@ -16575,7 +16575,14 @@ FUNCTION evaluatefunc$ (a2$, args AS LONG, typ AS LONG)
|
||||||
NEXT
|
NEXT
|
||||||
omitargs = omitarg_last - omitarg_first + 1
|
omitargs = omitarg_last - omitarg_first + 1
|
||||||
|
|
||||||
IF args <> id2.args - omitargs AND args <> id2.args THEN Give_Error "Incorrect number of arguments passed to function": EXIT FUNCTION
|
IF args <> id2.args - omitargs AND args <> id2.args THEN
|
||||||
|
IF LEN(id2.hr_syntax) > 0 THEN
|
||||||
|
Give_Error "Incorrect number of arguments - Reference: " + id2.hr_syntax
|
||||||
|
ELSE
|
||||||
|
Give_Error "Incorrect number of arguments passed to function"
|
||||||
|
END IF
|
||||||
|
EXIT FUNCTION
|
||||||
|
END IF
|
||||||
|
|
||||||
passomit = 1 'pass omit flags param to function
|
passomit = 1 'pass omit flags param to function
|
||||||
|
|
||||||
|
@ -16586,7 +16593,14 @@ FUNCTION evaluatefunc$ (a2$, args AS LONG, typ AS LONG)
|
||||||
IF n$ = "ASC" AND args = 2 THEN GOTO skipargnumchk
|
IF n$ = "ASC" AND args = 2 THEN GOTO skipargnumchk
|
||||||
IF id2.overloaded = -1 AND (args >= id2.minargs AND args <= id2.args) THEN GOTO skipargnumchk
|
IF id2.overloaded = -1 AND (args >= id2.minargs AND args <= id2.args) THEN GOTO skipargnumchk
|
||||||
|
|
||||||
IF id2.args <> args THEN Give_Error "Incorrect number of arguments passed to function": EXIT FUNCTION
|
IF id2.args <> args THEN
|
||||||
|
IF LEN(id2.hr_syntax) > 0 THEN
|
||||||
|
Give_Error "Incorrect number of arguments - Reference: " + id2.hr_syntax
|
||||||
|
ELSE
|
||||||
|
Give_Error "Incorrect number of arguments passed to function"
|
||||||
|
END IF
|
||||||
|
EXIT FUNCTION
|
||||||
|
END IF
|
||||||
|
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue