Line numbering strangeness

Blitz3D Forums/Blitz3D Programming/Line numbering strangeness

Yasha(Posted 2010) [#1]
I don't know if anyone's noticed or mentioned this before...

Often when running decent-sized files (say more than 500 lines) through the Blitz3D debugger, I find that the debugger highlight starts to "slip" and end up on the line above where it looks like it ought to be (in particularly bad cases, it could get to two or three lines). Signs that this is the case include highlighting the line above the "stop" (dead giveaway), things happening in the side panel before the cursor has moved over that line, and the wrong number of characters being highlighted (e.g. stopping in the middle of a word).

I eventually came to the conclusion that this is somehow connected to the fact that end-of-line is represented by two characters; if only the CR is present, the debugger loses count of the line (if only the LF is present, the program plain doesn't work, but this has never happened to me outside of intentionally testing it).

Anyway, having identified the problem, it's easy to fix: close the file from the editor, open it up in Notepad++ or something similar that provides line ending conversion, and convert the document to Mac format and back to Windows format (or turn on Show All Symbols and hunt for it by hand - this is how I found it).

The question is: what's causing this? The problem seems to occur in the course of regular editing, as I don't change editors in the middle of a project (except, as detailed above, to correct this problem if it appears). It definitely happens in IDEal, and I'm pretty sure I remember it affecting the default IDE as well. My best guess is that something is wrong with cut-and-paste...?

Anyway, it's not a big deal, but in the event this was confusing anyone else, there's one possible solution.


Stevie G(Posted 2010) [#2]
I use IDEal and this flaw has sent me on a wild goose chase many a time. Thanks for the fix!


xtremegamr(Posted 2010) [#3]
I also use IDEal. Do you think it's a bug in IDEal causing this?


_PJ_(Posted 2010) [#4]
I don't think thios has occurred in the default IDE, but yes, IDEal suffers greatly especially when there are a lot of files in a project particularly.

I assumed it was a problem with IDEal and perhaps something to do with whitespace - perhaps carriage return ASCII codes missing or confuused with vertical tabs etc.?


Axel Wheeler(Posted 2010) [#5]
Solved.

At least, I found one cause: Shift-Enter.

I tried a whole bunch of cut-paste scenarios, to/from ideal, the web, ms word, various deletes, undo's, and other things. This finally worked (or didn't work, depending on how you look at it.) Ctrl-Enter seems the same as Enter, Alt-Enter doesnt seem to do anything, but Shift-Enter looks like it does the same as enter, however it generates the error in question (so it's not being recognized by the debugger even though it displays as enter).

I distinctly remember this happening in the default ide, but it does not reproduce the error for me when the text is cut and pasted in. (although it is not actually showing the highlighting for some reason, just the curson placement. I have no idea why.) However, if I hit debug compile in Ideal with an error that Ideal itself won't catch (like a=0:b=5/a) the default ide lauches and displays the error at the incorrect spot.

So maybe it never was in the default ide, but we've seen it displayed there in debug compile. Or maybe there are other causes, or an update fixed it in the default ide. Or something else.

Solution: put some gibberish on a line in your code, put it to the clipboard including the carriage return, keep pasting it up or down until you find the offending line (undoing after each run). When you're on the right one you may get two lines highlighted. This is because the ide thinks it's all one line. Just select from the end of the offending line to the beginning of the next and replace with Enter.

When I did this to my current project (errors several lines off the mark!) in one case the offending line was a comment, and the error wasn't even recognized! The program ran without errors, with the gibberish line right there. That was weird. It thought the gibberish was part of the comment. In another case the offending line was an If statement. I got an "Endif without If" error on the Endif, not on the gibberish line.

Anyways,

BTW, I think this is also the cause of the infuriating "why isn't this line working" bug. The line is after a comment and shift-enter and is being interpreted as a comment. Ring a bell?


_PJ_(Posted 2010) [#6]
Happened to me. Actually gave me a headache here:
http://www.blitzbasic.com/Community/posts.php?topic=89833#1020920

I didn't spot the really obvious bug thanks to the IDEal debugger pointing to the line above the actual problem one!

---

I also encounter some weird stuff with IDEal line-numbering and searching etc. but mostly I think that's down to my preference of "folding" all the functions.


Axel Wheeler(Posted 2010) [#7]
I used to have to enter perhaps five blank lines between each line for a stretch, just to figure out which line was really the cause of the problem.


Fernhout(Posted 2010) [#8]
Ok guys i see the problem here. And i am starting to make a program that check the bb file for that error and correct them. its quite easy to do that. And it wil help a lot to let the program runt better.

Its not the IDE who is making the mistake but the text file make the mistake by forgetting one character in the new line command.

It wil take up a few days to make a good program that works. But when its finished i think you will be very happy.


Axel Wheeler(Posted 2010) [#9]
I just sent an email about this to Trixx, who appears to run Ideal and fungamesfactory.com. He hasn't been really active here in a while though, and Ideal was kind of "feature-complete" as I recall, but he might be induced to put this tweak in.


Fernhout(Posted 2010) [#10]
There from him a long time no reply on any mail. So i do not know if he doea it at all. The IDE ideal is a great feature for blitz3D. IT even better than the IDE that i sometime use for Dark basic. That one is realy fuzzy. I put in the cofiguration that all the key words has to capetelize but a lot of times the IDE don't know what is the key word and what is a variable.

The bad thing about htat ide is that if you declare a variable and you see its misspelled, i won't allow you to change that. Once give always given.
That sucks.


Fernhout(Posted 2010) [#11]
Hey guys i have made up fast a program to correct the problem on a fast way. Its completly text based but i think its a great help to do it.

the link is
http://home.kpn.nl/4384c61/Adventures.html

its all in dutch but your part is in english. Its at the bottom of the page.

i wil hear about it if it is oke.

You can also e-mail me at: bart_fernhout@...