1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-01 16:10:39 +00:00

Merge pull request #72 from SteveMcNeill/main

Further fix to searched.bin issues
This commit is contained in:
Steve McNeill 2022-05-18 12:41:03 -04:00 committed by GitHub
commit c441c22524
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 27 deletions

View file

@ -1,2 +0,0 @@
wiki

View file

@ -17668,23 +17668,11 @@ FUNCTION idesearchedbox$
ln = 0
l$ = ""
fh = FREEFILE
OPEN ".\internal\temp\searched.bin" FOR BINARY AS #fh: a$ = SPACE$(LOF(fh)): GET #fh, , a$
a$ = RIGHT$(a$, LEN(a$) - 2)
DO WHILE LEN(a$)
ai = INSTR(a$, CRLF)
IF ai THEN
f$ = LEFT$(a$, ai - 1): IF ai = LEN(a$) - 1 THEN a$ = "" ELSE a$ = RIGHT$(a$, LEN(a$) - ai - 3)
IF LEN(l$) THEN l$ = l$ + sep + f$ ELSE l$ = f$
ln = ln + 1
END IF
LOOP
CLOSE #fh
IF ln = 0 THEN
l$ = sep
END IF
REDIM SearchHistory(0) AS STRING
RetrieveSearchHistory SearchHistory()
FOR i = 1 to UBOUND(SearchHistory)
l$ = SearchHistory(i) + sep + l$
NEXT
'72,19
h = idewy + idesubwindow - 9
@ -18600,7 +18588,7 @@ FUNCTION removeDoubleSlashes$(f$)
END FUNCTION
SUB IdeAddSearched (s2$)
s$ = CRLF + s2$ + CRLF
s$ = s2$ + CRLF
fh = FREEFILE
OPEN ".\internal\temp\searched.bin" FOR BINARY AS #fh: a$ = SPACE$(LOF(fh)): GET #fh, , a$
x = INSTR(UCASE$(a$), UCASE$(s$))
@ -19986,13 +19974,18 @@ END FUNCTION
SUB RetrieveSearchHistory (SearchHistory() as string)
fh = FREEFILE
OPEN ".\internal\temp\searched.bin" FOR BINARY AS #fh
redim _preserve SearchHistory(1 to 10000) 'large initial array to hold the data
Do until eof(fh)
ln = ln + 1
if ln > ubound(SearchHistory) then redim _preserve SearhHistory(1 to ln + 10000) 'large resize, it necessary
line input #fh, SearchHistory(ln)
Loop
redim _preserve SearchHistory(1 to ln) 'resize to proper size before exit
redim _preserve SearchHistory(1 to 10000) AS STRING 'large initial array to hold the data
IF LOF(FH) THEN
Do until eof(fh)
ln = ln + 1
if ln > ubound(SearchHistory) then redim _preserve SearhHistory(1 to ln + 10000) AS STRING 'large resize, it necessary
line input #fh, SearchHistory(ln)
Loop
redim _preserve SearchHistory(1 to ln) AS STRING'resize to proper size before exit
ELSE
REDIM SearchHistory(1) AS STRING
SearchHistory(1) = ""
END IF
CLOSE #fh
end sub