The CMDebug edit windows allow you to edit and debug Windows batch files.
If a file in a tab edit window has been modified but not yet saved, the tab title will be prefixed with a *. When the file is saved, the * is removed.
If you are using TCC-RT syntax, you can get help for the currently selected (highlighted) command / variable / function by pressing Ctrl-F1, or right-clicking the mouse and selecting Help from the context menu. You can also hover the mouse over a TCC-RT variable name, and CMDebug will pop up a tooltip with the current value. If you hover the mouse over a TCC-RT internal command name, CMDebug will pop up a tooltip with the command syntax.
You can change the line to be executed next when in debugging mode by moving the caret to the line and either right clicking & selecting "Jump to This Line" or by pressing Ctrl-Shift-F11. Note that if you attempt to jump into or out of a DO loop or IFF block, bad things will happen!
You can block select in the edit window by holding down the Alt key while selecting text with the left mouse button.
The edit window supports multiple selections at one time. You can select additional text by holding down the Ctrl key while dragging with the mouse. Multiple selections are added to the clipboard in order with no delimiting characters. For block selections, the line end is added after each line of text. Block selections are always copied from top to bottom, not in the order of selection.
The editor will display document changes in the margin and in the text. In the text, inserted characters appear with colored underlines and points where characters were deleted are shown with small triangles. The margin shows a block indicating the overall state of the line. The states are modified (orange), saved (green), saved then reverted to modified (green-yellow), and saved then reverted to original (cyan). The change history can be toggled on or off with the "Options / Change History" menu entry.
There are three possible margins on the left of the edit window:
•The line number (selectable by the "Options / Display Line Numbers" menu option).
•The Breakpoint margin (left click in this margin to set a breakpoint on this line).
•The Fold margin (selectable by the "Options / Display Fold Margin" menu option), which will display a - for blocks that can be collapsed to a single line (DO, IFF, and SWITCH commands, and command groups). When a block is collapsed, the Fold margin will display a +. Left clicking in the Fold margin will toggle the fold state.
CMDebug will select the syntax lexer (colorization) based on the file extension:
|.bat ||CMD (or optionally TCC-RT)|
|.cmd ||CMD (or optionally TCC-RT)|
The edit window toolbar (which is configurable by clicking on the rightmost down arrow), has a number of icons to control debugging. Each has a tooltip for quick reference:
|New||Create a new batch file in a new tab window.|
|Open||Open an existing batch file in a new tab window.|
|Save||Save the current batch file.|
|Print||Print the current batch file.|
|Cut||Copy the highlighted selection to the clipboard and delete it from the file.|
|Copy ||Copy the highlighted selection to the clipboard.|
|Paste||Copy the contents of the clipboard to the current cursor location.|
|Delete||Delete the highlighted selection.|
|Redo||Restore the last Undo.|
|Batch Arguments||New batch file arguments. The text will be parsed into %1 - %n batch arguments and used when the batch file is debugged.|
|Start Debugging||Starts the debugger. The cursor will be placed on the first line.|
|Pause Debugging||Pause execution at the next line.|
|Stop Debugging||Stops the debugger.|
|Step Into||Execute the current line.|
|Step Over||Execute the current line but disable the debugger during a CALL or GOSUB.|
|Run to Breakpoint||Execute the batch file, stopping at the next breakpoint.|
|Toggle Breakpoint||Sets or turns off a breakpoint on the current line.|
|Clear Breakpoints||Clear all breakpoints in the current batch file.|
|File Properties||Displays information on the current batch file.|
|Start New Shell||Start another copy of TCC (this is useful if you need to perform some tasks while debugging a file.)|
|Help||Display the online help.|