The code editor (or code view) is the area of Charcoal where scripts are created and executed. Multiple buffers can be open in the code view, each with its own tab in the tab bar. When a new buffer is created (File->New), or an existing file is opened (File->Open), a new tab is created and made active.
A script, or section of a script, can be executed directly from the editor. The following hotkeys can be used to execute code in the active buffer:
- Ctrl+Enter - Execute selection (or execute all if nothing is selected)
- Ctrl+Shift+Enter - Execute All
- Ctrl+Alt+Enter - Execute Line
Every buffer in the code veiw has a tab, in the tab bar, that is created with the buffer. Each tab has a name based on the file or interpreter type (temporary buffers). A tab name can be changed by right-clicking on the tab and selecting Rename... from the context menu. Renaming a temporary buffer will only change the tab name. Renaming a file will change the name of the file on disk.
A tab can be reordered by dragging the tab left or right in the tab bar. Additionally, a tab can be moved to a different code view by dragging the tab into the other view (or by right-clicking on the tab and selecting Move to Other View from the context menu)
The display and behavior of tabs in the the code editor can be modified in Preferences:
- Show Tab Bar - Display the tab bar in the code editor.
- Lock Tabs - Disable the ability to reorder tabs in the tab bar.
- Show close all but this menu item - Include the Close all but this menu item in the tab context menu.
- Show close button on each tab - Display the close button on each tab in the tab bar.
- Insert documents to the left of existing tabs - New buffers will be added on the left side of the tab bar.
- Double click to close - Double clicking on a tab closes the buffer