Edit

From Br Wiki
Jump to: navigation, search

Requires BR version 4.15+

The Edit (E) command does the following:

  1. Lists the currently loaded program to a source file
  2. Launches your editor and sets focus to it.
  3. After you save the changes in the editor, you can press enter in your BR window or use Edit ~ to merge the changed lines into the program.

Syntax

EDIT <program>

Edit.png

If a program name is specified, then the program is loaded and then standard Edit processing is performed. If program-name is not specified then standard Edit processing is performed on the currently loaded program. The Edit command requires a BRConfig.sys specification for Editor, or a Config statement for Editor.

The Edit command requires the BRConfig.sys specification for Editor, as illustrated here:

EDITOR "editor-program" [ REMOVE ] [NOWAIT]
or
CONFIG EDITOR ...

In the following example, the program contains only one line and is currently loaded in memory. The BRConfig.sys file contains the statement:

EDITOR "C:\Program Files\JGsoft\EditPadPro\EditPadPro.exe"

NEWC0011.jpg

EditPadPro is called:

NEWC0012.jpg

Suppose that the following changes are made and saved using EditPadPro:

NEWC0013.jpg


Switch to your BR window and press Enter, and the result will be:

NEWC0014.jpg

Standard Edit Command Processing

If the editor has not been set either in BRConfig.sys or via a config editor statement then the Edit command will produce error 9307.

To determine if you currently have selected an editor, Status Config can be used.

The source file will be named "program_name-wsid.brs" and it will be located in the same directory as the .BR file.

If EDITOR "editor-program" REMOVE is specified in BRConfig.sys, then the .BRS file is removed upon successful completion of merging in the changes.

If EDITOR "editor-program" NOWAIT is specified in BRConfig.sys, then BR will not wait for the user to press the ENTER key before merging in the changes. It just waits for the return from the editor. Many good editors return control immediately and let you edit multiple files, so NOWAIT would not apply. NOWAIT works for simple editors such as Notepad.

The resulting text is sorted and checked for duplicates. If duplicate lines are encountered, error 1156 is generated. If a program is changed by the Edit command and the changes are being merged, and the user types GO after correcting a line being merged then the merge (Proc) operation will continue.

If the Edit command is issued after an unsuccessful merge (instead of GO) then the most recent editor-modified workfile will be passed to the editor.

Specify "Edit -" to utilize (recover) the previous Edit BR source file, provided EDITOR ... REMOVE is not in effect.

NOTE: Do not use the Tab key in your text editor. BR will produce an error on lines which contain the Tab key.