GLBasic forum

Main forum => Bug Reports => Topic started by: AndyH on 2008-Feb-03

Title: Function blocks in Editor
Post by: AndyH on 2008-Feb-03
Just a small niggle rather than an issue -

If you declare a FUNCTION that does not start on a line, the Green Bar in the margin of the source code editor that will normally mark the start and end of the function will not register.  Instead, the green bar extends upwards to either the next FUNCTION declaration that is at the start of the line, or the top of the code if there isn't one.  Also the Jumps panel in the editor changes from an F(x) icon to a bullet point.

Similarly, if an ENDFUNCTION is not at the beginning of a line the green bar in the editor margin will ignore it and will extend downwards to the next ENDFUNCTION that starts at the beginning of a line.

EG:

Code (glbasic) Select
FUNCTION foo:
  // this is OK!
ENDFUNCTION


  FUNCTION bar:
  // this FUNCTION is not recognised in the margin of the editor
ENDFUNCTON

FUNCTION doh:
  // this functions ENDFUNCTION is not recognised in the margin of the editor
  ENDFUNCTION

  FUNCTION dohdoh:
    // eek! the solution is to put the FUNCTION and ENDFUNCTION in column 0, the start of every line, no spaces or tabs before
  ENDFUNCTION
The spaces or tabs in front of FUNCTION / ENDFUNCTION's makes the editor not recognise them in the margin color coding.
Title: Function blocks in Editor
Post by: Moru on 2008-Feb-03
Why would you want spaces or tabs before the functions? This is just how I expect the editor to work. If I type a space in front by accident I want to know about it :-)
Title: Function blocks in Editor
Post by: AndyH on 2008-Feb-03
Space is not an invalid character AFAIK.  No big deal, but what if you want to indent your code to help readability?  Eg:  I want to re-use as much code as possible between projects so I use additional source files.  In these files I might make a load of functions I want to re-use.  To keep code as simple as possible, and without overloading a function's contents with 100's of lines of code I make more functions, but many of these I don't want to use or worry about in my main game, they are just there to for that source file.  As GLB does not have any private or protected blocks, and is not OOP, I keep to a naming convention for these private functions.  For readability I can indent them from the left margin so it is clear what they are.
Title: Function blocks in Editor
Post by: Kitty Hello on 2008-Feb-04
Fixed in next update.
Title: Function blocks in Editor
Post by: bigsofty on 2008-Feb-04
Bah, missed my classic Microsoft Quote chance... "Its not a bug, its a feature!" :D
Title: Function blocks in Editor
Post by: Schranz0r on 2008-Feb-04
;)

like a bluescreen :)