The WinConsole Editor is the area where the source text of the program is displayed, edited, and debugged.
The Editor Margin is the far left margin of the Editor area, which is used to indicate information about the program in the editor. Different colors and symbols are put into the margin to indicate the following:
Execution Line: The next line to be executed is indicated by a blue arrow pointing at the line.
Breakpoints: Breakpoints are indicated by a red rectangle containing the word Stop. When the margin is clicked on while the program is not busy, a breakpoint will be toggled on that line. If the line has no breakpoint, it will be turned on. If the line has a breakpoint, it will be turned off. For more information on breakpoints, see Debugging a Program in WinConsole.
Syntax Errors: Syntax errors are indicated by a yellow rectangle containing the word Error. When the syntax is corrected and the cursor is moved to a different line, the BBj interpreter will evaluate the corrected line and remove the Error from the margin.
Line Numbers: If the program source relies on physical line numbers rather than user line numbers, the physical line numbers will be displayed in the margin. See WinConsole Line Numbers for more information.
Editor Pop-up Menu
The Editor Pop-up Menu appears when the mouse is right clicked in the Editor. It contains the Find and Display Line menu options:
Find: Displays a dialog to find and replace text in the editor. To find a string, type or paste it into the Find field and click the Find button. Any text selected in the editor will automatically be placed into the find field when the dialog is opened. The find will begin searching at the current caret location in the editor. It will look down to the end of the file or up to the beginning of the file, depending on the search option selected.
To change the direction of the search, select one of the radio buttons in the Options section. When the Find button is clicked, the next occurrence of the string will be scrolled into view in the editor and highlighted until there are no more occurrences of the string in the current direction. When there are no more occurrences of the string, a dialog will display stating that the search has been completed.
To replace an occurrence of a string, type or paste the string to be replaced into the Find field, and the replacement string in the Replace With field. Click the Replace button. The first time the Replace button is clicked, it will find and highlight the first occurrence of the string. After the first time the button is clicked, it will replace the highlighted occurrence and then find and highlight the next occurrence.
To replace all occurrences of a string at once, click the Replace All button. This will replace all occurrences with the string and display a dialog when completed stating how many occurrences were replaced.
Display Line: Displays a dialog to go to a specific physical line in the program. Enter a line number within the range displayed and click OK. Note that the Display Line dialog works only with physical line numbers, not user line numbers. To quickly move to a given user line number, use the GOTO verb from the command line. For more information, see Editing a Program in WinConsole.
Two different types of line numbers are recognized in the BBj WinConsole:
User line numbers are the traditional Business Basis line numbers embedded in program source code. These line numbers must appear in ascending numerical order, but may contain large gaps in the sequence. User line numbers appear only in the editing area of the WinConsole, never in the margin. Pasting additional text into a program containing user line numbers will result in syntax errors that the user must correct manually. The GOTO verb can be used from the command line to move the cursor to a given user line number, whereas the Display Line option in the pop-up menu works only for physical line numbers.
Physical line numbers are sequential line numbers assigned by the BBj interpreter when a program does not contain embedded user line numbers. They refer to the actual index of the line within the file and are one-based. For example, if there are 5 lines in a program, then the lines will be numbered (1,2,3,4, and 5). Physical line numbers are not displayed with the program text in the editing area, but instead are shown in the editor margin. The line that the text caret is in can be determined in the Caret section of the status bar. (The first number indicates the physical line number, and the second number indicates the column.) The GOTO verb cannot be used with physical line numbers, unless they happen to line up with the user line numbers.
It is not possible to mix lines with user line numbers and lines without user line numbers in the same program file. The BBj preferred method is to do without user line numbers. If compatibility with older programming styles must be maintained, the RENUM verb can be used to add user line numbers to a program that does not already have them.