Posts: 1,616
Threads: 157
Joined: Apr 2022
Reputation:
77
11-12-2022, 03:09 AM
(This post was last modified: 11-12-2022, 04:13 PM by Pete.)
So I start typing away at this itty bitty program when all of a sudden, bam! The crazy IDE eats a piece of my code. Well Jane, I look at the screen and say, "Hey! Why'd you eat a piece of my code?" Now the I-D-E, it can't talk back to me, especially with it's mouth all full of my code, but it just goes to show you, Jane, it's always something...
Try and type then press Enter...
Code: (Select All) REDIM c$(1000): idx = UBOUND(c$) - _HEIGHT - 125
Sam Samannadanna
Posts: 456
Threads: 63
Joined: Apr 2022
Reputation:
10
(11-12-2022, 03:09 AM)Pete Wrote: So I start typing away at this itty bitty program when all of a sudden, bam! The crazy IDE eats a piece of my code. Well Jane, I look at the screen and say, "Hey! Why'd you eat a piece of my code?" Now the I-D-E, it can't talk, especially with it's mouth all full of my code.
I tell you Jane, it's always something...
Try and type then press Enter...
Code: (Select All) REDIM c$(1000): idx = UBOUND(c$) - _HEIGHT - 125
Sam Samannadanna Weird!
Can't wait for you to explain what happened to the end bit!
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.)
Posts: 1,507
Threads: 160
Joined: Apr 2022
Reputation:
116
It's been ages since I last found a code-eatting bug. Generally this thing is some error checking and formatting going on in the IDE that just loses track of a variable due to them being recycled repeatedly. Without looking at the code, my bet is going to be on e$ getting overwritten somewhere that it shouldn't be. Since this is such a short piece of code which produces the glitch (thanks for that! The last code-eatting bug I chased down would eat two pages of code at once and was a real PITA to narrow down the root source!), I imagine the problem in is _HEIGHT.
If no one else gets around to it first, I'll dig into it and look for the issue once I finish playing around with the load/save dialogs and chasing after your silly SCREEN 0 + _FONT memory leak, which is currently breaking my brain.
Posts: 1,616
Threads: 157
Joined: Apr 2022
Reputation:
77
Actually, I have another one. Failure to capitalize.
Now not everyone has the cap keyword option activated, so if you don't don't bother trying this out. If you do, you'll notice when you hit Enter, the keywords will not be capitalized.
Code: (Select All) if a then else
Pete
Posts: 1,507
Threads: 160
Joined: Apr 2022
Reputation:
116
Quit finding glitches! Or else we're going to make you start debugging them!
Posts: 1,616
Threads: 157
Joined: Apr 2022
Reputation:
77
Another weird one is in version 3.30, I can't get it to save more than 3 searches in the search history. I tried clearing it. Okay, cleared, but once again after the third search got added, it stopped saving additional searches.
Pete
Posts: 1,510
Threads: 53
Joined: Jul 2022
Reputation:
47
11-12-2022, 04:12 AM
(This post was last modified: 11-12-2022, 04:19 AM by mnrvovrfc.)
(11-12-2022, 03:22 AM)Pete Wrote: Actually, I have another one. Failure to capitalize.
:
Code: (Select All) if a then else
Pete It's because if "THEN" part is to remain empty, it needs to be in a block "IF", that's what the "formatter" is expecting. In fact it should return an error for not having "END IF" at the end of it all, but it defeats itself because the whole thing is a single-line "IF" statement that it knows it should support back to GW-BASIC.
(11-12-2022, 03:09 AM)Pete Wrote: Try and type then press Enter...
Code: (Select All) REDIM c$(1000): idx = UBOUND(c$) - _HEIGHT - 125
Likely this is the "formatter" thinking the first parameter for "UBOUND" should have parenthesis because it should be the name of an array but doesn't want any parenthesis, which makes it a PITA (wanted to say "special case" but writing a parser for any language is not easy and don't tell me using LISP to write it makes it easier!) So the "formatter" tries to put one for "_HEIGHT". Indeed this is the weirdest I've seen this slow editor doing. :/
BTW changed "UBOUND" to "LBOUND" and does the same thing. Changed "_HEIGHT" to "_WIDTH", no change. Added "(0)" to the end of "_HEIGHT" it didn't dare change it.
Posts: 456
Threads: 63
Joined: Apr 2022
Reputation:
10
(11-12-2022, 03:32 AM)Pete Wrote: Another weird one is in version 3.30, I can't get it to save more than 3 searches in the search history. I tried clearing it. Okay, cleared, but once again after the third search got added, it stopped saving additional searches.
Pete Uh,oh, now you're in trouble!
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.)
Posts: 1,510
Threads: 53
Joined: Jul 2022
Reputation:
47
@Pete
I hope that you don't have to call "REDIM _PRESERVE" 50 times or so inside a loop before you transfer the code you showed off in the other thread LOL.
Posts: 1,616
Threads: 157
Joined: Apr 2022
Reputation:
77
11-12-2022, 05:54 AM
(This post was last modified: 11-12-2022, 06:00 AM by Pete.)
Au contraire!
Press any key then type in something you want added to the list.
Code: (Select All) FOR i = 1 TO 50
REDIM _PRESERVE c$(i)
c$(i) = LTRIM$(STR$(i))
NEXT
WIDTH 80, 25
idx = -1: GOSUB dsp
DO
_LIMIT 60
WHILE _MOUSEINPUT
mw = mw + _MOUSEWHEEL
WEND
IF mw <> oldmw THEN
adj = SGN(mw - oldmw): mw = 0
IF idx > 0 AND adj < 0 OR idx <= UBOUND(c$) - (_HEIGHT - 1) AND adj > 0 THEN GOSUB dsp
END IF
oldmw = mw
b$ = INKEY$
IF LEN(b$) THEN
LOCATE 1, 10: LINE INPUT "Add what to list? "; ans$
IF LEN(ans$) THEN
REDIM _PRESERVE c$(UBOUND(c$) + 1)
c$(UBOUND(c$)) = ans$
idx = -1: GOSUB dsp
END IF
END IF
LOOP
dsp:
CLS
IF idx < 0 THEN
idx = UBOUND(c$) - (_HEIGHT - 2)
IF idx <= 1 THEN idx = 0
ELSE
idx = idx + adj
END IF
LOCATE 1, 1
i = idx: j = 0
DO
i = i + 1
j = j + 1: LOCATE j, 1
PRINT c$(i)
LOOP UNTIL CSRLIN = _HEIGHT - 1 OR i = UBOUND(c$)
RETURN
So you can add without worry of counting. Also, for testing, you don't need to change a DIM statement plus the array statement. Another plus is this method allows you to use ubounds() instead of a terminal counter.
Pete
|