1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-05 03:00:25 +00:00

Keep watch list selection across edits (same session)

This commit is contained in:
FellippeHeitor 2021-10-02 02:38:12 -03:00
parent 4face3fc55
commit 7c17c987cb
3 changed files with 38 additions and 3 deletions

View file

@ -11,7 +11,7 @@ DIM SHARED IDEBuildModeChanged
DIM SHARED IdeInfo AS STRING DIM SHARED IdeInfo AS STRING
DIM SHARED IdeContextHelpSF AS _BYTE DIM SHARED IdeContextHelpSF AS _BYTE
DIM SHARED host&, debugClient&, hostport$, variableWatchList$, watchpointList$ DIM SHARED host&, debugClient&, hostport$, variableWatchList$, backupVariableWatchList$, watchpointList$
DIM SHARED vWatchReceivedData$(1 TO 1000), nextvWatchDataSlot, latestWatchpointMet& DIM SHARED vWatchReceivedData$(1 TO 1000), nextvWatchDataSlot, latestWatchpointMet&
DIM SHARED startPausedPending AS _BYTE DIM SHARED startPausedPending AS _BYTE

View file

@ -509,6 +509,7 @@ FUNCTION ide2 (ignore)
REDIM IdeBreakpoints(iden) AS _BYTE REDIM IdeBreakpoints(iden) AS _BYTE
REDIM IdeSkipLines(iden) AS _BYTE REDIM IdeSkipLines(iden) AS _BYTE
variableWatchList$ = "" variableWatchList$ = ""
backupVariableWatchList$ = "": REDIM backupUsedVariableList(1000) AS usedVarList
watchpointList$ = "" watchpointList$ = ""
callstacklist$ = "": callStackLength = 0 callstacklist$ = "": callStackLength = 0
ideunsaved = -1 ideunsaved = -1
@ -606,6 +607,7 @@ FUNCTION ide2 (ignore)
REDIM IdeBreakpoints(iden) AS _BYTE REDIM IdeBreakpoints(iden) AS _BYTE
REDIM IdeSkipLines(iden) AS _BYTE REDIM IdeSkipLines(iden) AS _BYTE
variableWatchList$ = "" variableWatchList$ = ""
backupVariableWatchList$ = "": REDIM backupUsedVariableList(1000) AS usedVarList
watchpointList$ = "" watchpointList$ = ""
callstacklist$ = "": callStackLength = 0 callstacklist$ = "": callStackLength = 0
IF ideStartAtLine > 0 AND ideStartAtLine <= iden THEN IF ideStartAtLine > 0 AND ideStartAtLine <= iden THEN
@ -1164,7 +1166,6 @@ FUNCTION ide2 (ignore)
IF idelayoutallow THEN idelayoutallow = idelayoutallow - 1 IF idelayoutallow THEN idelayoutallow = idelayoutallow - 1
variableWatchList$ = ""
watchpointList$ = "" watchpointList$ = ""
idecurrentlinelayouti = 0 'invalidate idecurrentlinelayouti = 0 'invalidate
idefocusline = 0 idefocusline = 0
@ -8682,11 +8683,24 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction)
IF K$ = CHR$(27) OR (IdeDebugMode = 0 AND focus = 5 AND info <> 0) OR _ IF K$ = CHR$(27) OR (IdeDebugMode = 0 AND focus = 5 AND info <> 0) OR _
(IdeDebugMode > 0 AND focus = 7 AND info <> 0) THEN (IdeDebugMode > 0 AND focus = 7 AND info <> 0) THEN
variableWatchList$ = "" variableWatchList$ = ""
backupVariableWatchList$ = "" 'used in case this program is edited in the same session
longestVarName = 0 longestVarName = 0
nextvWatchDataSlot = 0 nextvWatchDataSlot = 0
totalVisibleVariables = 0 totalVisibleVariables = 0
totalSelectedVariables = 0
FOR y = 1 TO totalVariablesCreated FOR y = 1 TO totalVariablesCreated
IF usedVariableList(y).includedLine THEN _CONTINUE 'don't deal with variables in $INCLUDEs IF usedVariableList(y).includedLine THEN _CONTINUE 'don't deal with variables in $INCLUDEs
totalSelectedVariables = totalSelectedVariables + 1
backupVariableWatchList$ = backupVariableWatchList$ + MKL$(-1)
backupVariableWatchList$ = backupVariableWatchList$ + MKL$(LEN(usedVariableList(y).cname)) + usedVariableList(y).cname
backupVariableWatchList$ = backupVariableWatchList$ + MKL$(totalSelectedVariables)
WHILE totalSelectedVariables > UBOUND(backupUsedVariableList)
REDIM _PRESERVE backupUsedVariableList(totalSelectedVariables + 999) AS usedVarList
WEND
backupUsedVariableList(totalSelectedVariables) = usedVariableList(y)
usedVariableList(y).storage = ""
IF usedVariableList(y).watch THEN IF usedVariableList(y).watch THEN
thisLen = LEN(usedVariableList(y).name) thisLen = LEN(usedVariableList(y).name)
IF usedVariableList(y).isarray THEN IF usedVariableList(y).isarray THEN
@ -11913,6 +11927,7 @@ FUNCTION idefiledialog$(programname$, mode AS _BYTE)
REDIM IdeBreakpoints(iden) AS _BYTE REDIM IdeBreakpoints(iden) AS _BYTE
REDIM IdeSkipLines(iden) AS _BYTE REDIM IdeSkipLines(iden) AS _BYTE
variableWatchList$ = "" variableWatchList$ = ""
backupVariableWatchList$ = "": REDIM backupUsedVariableList(1000) AS usedVarList
callstacklist$ = "": callStackLength = 0 callstacklist$ = "": callStackLength = 0
ideerror = 1 ideerror = 1

View file

@ -120,6 +120,7 @@ TYPE usedVarList
AS STRING elementOffset, storage AS STRING elementOffset, storage
END TYPE END TYPE
REDIM SHARED backupUsedVariableList(1000) AS usedVarList
DIM SHARED totalVariablesCreated AS LONG, totalMainVariablesCreated AS LONG DIM SHARED totalVariablesCreated AS LONG, totalMainVariablesCreated AS LONG
DIM SHARED bypassNextVariable AS _BYTE DIM SHARED bypassNextVariable AS _BYTE
DIM SHARED totalWarnings AS LONG, warningListItems AS LONG, lastWarningHeader AS STRING DIM SHARED totalWarnings AS LONG, warningListItems AS LONG, lastWarningHeader AS STRING
@ -26076,7 +26077,7 @@ SUB dump_udts
END SUB END SUB
SUB manageVariableList (__name$, __cname$, localIndex AS LONG, action AS _BYTE) SUB manageVariableList (__name$, __cname$, localIndex AS LONG, action AS _BYTE)
DIM findItem AS LONG, cname$, i AS LONG, name$ DIM findItem AS LONG, cname$, i AS LONG, j AS LONG, name$, temp$
name$ = RTRIM$(__name$) name$ = RTRIM$(__name$)
cname$ = RTRIM$(__cname$) cname$ = RTRIM$(__cname$)
@ -26098,6 +26099,7 @@ SUB manageVariableList (__name$, __cname$, localIndex AS LONG, action AS _BYTE)
IF i > UBOUND(usedVariableList) THEN IF i > UBOUND(usedVariableList) THEN
REDIM _PRESERVE usedVariableList(UBOUND(usedVariableList) + 999) AS usedVarList REDIM _PRESERVE usedVariableList(UBOUND(usedVariableList) + 999) AS usedVarList
END IF END IF
usedVariableList(i).id = currentid usedVariableList(i).id = currentid
usedVariableList(i).used = 0 usedVariableList(i).used = 0
usedVariableList(i).watch = 0 usedVariableList(i).watch = 0
@ -26127,9 +26129,12 @@ SUB manageVariableList (__name$, __cname$, localIndex AS LONG, action AS _BYTE)
IF LEN(RTRIM$(id.musthave)) > 0 THEN IF LEN(RTRIM$(id.musthave)) > 0 THEN
usedVariableList(i).name = name$ + RTRIM$(id.musthave) usedVariableList(i).name = name$ + RTRIM$(id.musthave)
ELSEIF LEN(RTRIM$(id.mayhave)) > 0 THEN
usedVariableList(i).name = name$ + RTRIM$(id.mayhave)
ELSE ELSE
usedVariableList(i).name = name$ usedVariableList(i).name = name$
END IF END IF
IF (id.arrayelements > 0) THEN IF (id.arrayelements > 0) THEN
usedVariableList(i).isarray = -1 usedVariableList(i).isarray = -1
usedVariableList(i).name = usedVariableList(i).name + "()" usedVariableList(i).name = usedVariableList(i).name + "()"
@ -26143,6 +26148,21 @@ SUB manageVariableList (__name$, __cname$, localIndex AS LONG, action AS _BYTE)
usedVariableList(i).elementTypes = "" usedVariableList(i).elementTypes = ""
usedVariableList(i).elementOffset = "" usedVariableList(i).elementOffset = ""
totalVariablesCreated = totalVariablesCreated + 1 totalVariablesCreated = totalVariablesCreated + 1
temp$ = MKL$(-1) + MKL$(LEN(cname$)) + cname$
found = INSTR(backupVariableWatchList$, temp$)
IF found THEN
'this variable existed in a previous edit of this program
'in this same session; let's preselect it.
j = CVL(MID$(backupVariableWatchList$, found + LEN(temp$), 4))
usedVariableList(i).watch = backupUsedVariableList(j).watch
usedVariableList(i).watchRange = backupUsedVariableList(j).watchRange
usedVariableList(i).indexes = backupUsedVariableList(j).indexes
usedVariableList(i).elements = backupUsedVariableList(j).elements
usedVariableList(i).elementTypes = backupUsedVariableList(j).elementTypes
usedVariableList(i).elementOffset = backupUsedVariableList(j).elementOffset
END IF
END IF END IF
CASE ELSE 'find and mark as used CASE ELSE 'find and mark as used
IF found THEN IF found THEN