Wing IDE Reference Manual
   
Wing IDE Reference Manual

Version 1.1b7-2


next up previous contents
Next: 5. Source Code Browser Up: Wing IDE Reference Manual Previous: 3. Project Manager


Subsections

4. Source Code Editor

Wing IDE's source code editor is designed to make it easier to adopt the IDE even if you are used to using other editors. If you are frustrated by the editor or key combinations, please review information in this chapter and in the Customization chapter; you have a fair amount of control over how the editor acts.


   For those in a rush, key things to know about the editor are:
  • The editor has personalities, including one similar to basic editors on Windows and another similar to emacs.
  • Key mappings are configurable.
  • The editor supports a wide variety of file types for syntax colorization.
  • Auto-completion is supported for Python source (but can be turned off if desired).


4.1 Syntax Colorization

The editor will attempt to colorize documents according to their MIME type, which is determined by the file extension, or content. For example, any file ending in '.py' will be colorized as a Python source code document. Any file whose MIME type cannot be determined will display all text in black normal font by default.

4.1.1 Supported file types

The editor supports the following file types for syntax colorization:

Mime Type Description Allowable Extensions
text/x-python Python Source py, cgi, or files starting with a #! specifier
    that invokes Python
text/html HTML Source html, htm, asp, shtml
text/x-c-source C Language Source c, h
text/x-cpp-source C++ Source cc, cpp, cxx, hh, hpp, hxx
text/x-java-source Java Source java
text/x-vb-source Visual Basic Source cls, bas, ctl, frm, vbs
text/x-dos-batch DOS Batch File bat
text/x-properties DOS Style INI File properties, ini, inf, reg
text/x-makefile Makefile makefile, mak, and any file named
    'makefile' or 'Makefile'
text/x-errorlist Compilation Error List err
text/x-sql SQL Source sql
text/x-plsql PL SQL Source spec, body, sps, spb, sf, sp
text/x-xml XML Source xml, xul, glade
application/x-tex LaTeX Source tex, sty
text/x-lua-source Lua Source lua
text/x-idl CORBA IDL idl, odl
text/x-javascript Javascript js
text/x-rc DOS RC File rc, rc2, dlg
text/x-php-source PHP Source php, php3, phtml, inc
text/x-perl Perl Source pl, pm, pod
text/x-diff Diff/CDiff or Patch File diff, patch
text/x-conf Conf Files conf
text/x-pascal Pascal Source pas, inc
text/x-ave Ave document ave
text/x-ada Ada Source abs, adb
text/x-ave Eiffel Source e
text/x-ave Lisp Source lsp, lisp
text/x-ave Ruby Source rb
text/x-ave Bash File sh, bsh
text/plain Plain Text (no highlighting) all others



If you have a file that is not being recognized, you can use the Source Menu's Syntax Highlighting section to alter the way the file is being displayed. Your selections from this menu are stored in your project file, so changes made here are permanent in the context of that project.

If you have many files with an unrecognized extension, you can alter the main.extra-mime-types preference to add your extension. See section 2.2.7 for details on setting this value. Note however that adding a new MIME type not already in the list above will not work without more extensive modifications to the IDE source code.

4.1.2 Colorization Options

Although the specific colors and other values associated with syntax colorization are not yet user-configurable, you can alter the text and font that is used throughout a file or files. To do this, select the Set Display Font/Size item from the Source menu and make your selection from the dialog's popup menus.

You can make changes for individual files on a per-file basis, or for all files that you open. Either way, your selection is saved in the project file for subsequent work sessions.

Changes are shown immediately on your source, but are only permanent after the font/size selection dialog is closed if you use the Apply and Exit button. Otherwise, values are restored to those in use before the selector dialog was displayed.

4.2 Navigating your Source


   When you right-click on the surface of the editor, all editor windows will bring up a popup menu with commonly used commands such as Copy, Paste, Undo, and Redo. When the file is a Python file, this menu also includes a construct-by-construct breakdown of the source file.

In order to navigate your source, right-click on the editor surface and select one of the constructs in the popup menu. This will scroll the source code to the position at which that construct is defined and select its point of definition.

Python language constructs in the popup menu are colorized as follows:

You can also use the Goto Definition menu item in the right-click popup menu to click on a construct in your source and zoom to its point of definition.

The editor popup menu is also available from the popup button at the lower right corner of the editor window.

4.3 Structural Folding

The editor supports optional structural folding for Python, C, C++, Java, Javascript, HTML, files, Eiffel, Lisp, and Ruby files. This allows you to visually collapse logical hierarchical sections of your code as you are working in other parts of the file.

Because this feature adds overhead, it is turned off by default. You can turn it on from the Structural Folding section of the Source menu, or by setting the edit.enable-folding preference to true (this value is used for new projects also). The preference edit.fold-line-mode can be used to determine whether or not a horizontal line is drawn at fold points, whether it is drawn above or below the fold point, and whether it is shown when the fold point is collapsed or expanded. See section 4.14 for allowed values for this preference.

Once folding is turned on, an additional margin appears to the left of source files, where fold points are by default indicated with blue minus signs. Left mouse click on one of these signs to collapse that fold point. Once collapsed, the fold point is by default indicated by a blue plus sign. Clicking again will re-expand it. Preference edit.fold-indicator-style can be used to change the style of indicators used at fold points to arrows, or tree style views. Details for changing this preference are in section 4.14

You can also hold down the following key modifiers while clicking to modify the folding behavior:

Fold commands are also available in the Structural Folding section of the Source menu and by the indicated key equivalents:

Since only a subset of file types supported by Wing IDE also support folding, the preference edit.fold-mime-types is used to turn on folding by mime type for only specific file types. This will generally remain unchanged from the defaults but can be used to turn off folding for specific file types, such as only C or only Python source, while keeping folding on for other files.

4.4 Brace Matching

Wing will highlight matching braces in green when the cursor is adjacent to a brace. Mismatched braces are highlighted in red.

You can also cause Wing to select the entire contents of the innermost brace pair from the current cursor position with the Match Braces item in the Source menu.

Parenthesis, square brackets, and curly braces are matched in all files. Angle brackets (< and >) are matched also in HTML and XML files.


4.5 Indentation

The editor provides a range of features for managing indentation in source code. The following preferences affect how the indentation features behave in newly created source files and non-Python files:

  1. The preference edit.tab-size defines the default size of each tab character, in spaces.
  2. The preference edit.indent-size defines the default size of each level of indent, in spaces.
  3. The preference edit.indent-style defines the default indentation style, one of 'spaces-only', 'tabs-only', or 'mixed'. Mixed indentation replaces each tab-size spaces with one tab character.
  4. The preference edit.auto-indent controls whether or not each new line is automatically indented.
  5. The preference edit.show-indent-guides controls whether or not to show indentation guides as light vertical lines. This value can be overridden on a file by file basis from the Indentation section of the Source menu.

When an existing Python file is opened, it is scanned to determine what type of indentation that is used in that file. If the file contains some indentation, this may override the tab size, indent size, and indent style values given in preferences and the file is subsequently indented in a way that matches its existing content rather than your configured defaults.

For non-Python files, this check does not occur and you can change indentation styles on the fly using the Use Spaces Only, Use Tabs Only, and Use Mixed Tabs and Spaces items in the Indentation portion of the Source menu.

For Python files, you may convert the entire file between different forms of indentation using the Indentation Manager available from the Indentation portion of the Source menu. This is described in section 4.5.5 below.


   Note that tab size is automatically forced to 8 characters for all Python source files that contain some spaces in indentation, since the Python interpreter defines tabs as 8 characters in size in this case. This version of Wing does not recognize vi style tab size comments, but it does apply the configured tab-size when a file contains only tabs in indentation.

4.5.1 Auto-Indent

The IDE ships with auto-indent turned on. This causes leading white space to be added to each newly created line, as return or enter are pressed. Enough white space is inserted to match the indentation level of the previous line, possibly adding a level of indentation if this is indicated by context in the source (such as if or while).

Note that if preference edit.auto-indent is set to false, auto-indent does not occur until the tab key is pressed.

4.5.2 The Tab Key

By default, the tab key acts like auto-indent: the leading white space of the current line is adjusted to achieve a reasonable indentation level for that line.

Existing leading white space is replaced with white space containing either spaces only or tabs and spaces, as determined by the method described above. This behavior may also decrease indent level of a line, if it is deemed to be indented too far according to its context.

If multiple lines are selected at the time that the tab key is pushed, all those lines will be indented or outdented as a unit according to the amount of change necessary for the first line in the selected unit. This is very useful when moving around blocks of code.

To insert a real tab character regardless of the indentation mode or the position of the cursor on a line, type ctrl-tab.

4.5.3 Checking Indentation

Wing analyses existing indentation whenever it opens a Python source file, and will indicate a potentially problematic mix of indentation styles, allowing you to attempt to repair the file. Although files are checked each time they are opened, Wing will display the indentation warning dialog only once per file and will not ask twice about the same file if you do not repair it (this information is stored in the project file). Files can be inspected more closely or repaired at any time using the Indentation Manager described in section 4.5.5.


   In general, mixing tab/space and space-only indentation in the same file can be confusing, especially if files are viewed with different editors and by different developers. We recommend using spaces only or tabs only as the best alternatives. To convert existing code containing a mix of tabs and spaces, use the Indentation Manager.

4.5.4 Changing Block Indentation

Wing provides Indent and Outdent commands in the Indentation portion of the Source menu, to support increasing or decreasing the level of indentation for selected blocks of text. All lines that are included in the current text selection are moved, even if the entire line isn't selected.

Indentation placed by these commands will contain either only spaces, only tabs, or a mixture of tabs and spaces, as determined by the method described at the start of section 4.5 above.


4.5.5 Indentation Manager

The indentation manager can be used to inspect and change indentation style in Python language source. To display the indentation manager for a given file, use the Indentation Manager item in the Indentation group of the Source menu.

The indentation manager has two parts to it: (1) The indentation report, and (2) the indentation converter.

A report on the nature of existing indentation found in your Python source file is given above the horizontal divider. This includes the number of spaces-only, tabs-only, and mixed tabs-and-space indents found, information about whether indentation in the file may be problematic to the Python interpreter, and the tab and indent size computed for that file. The manager also provides information about where the computed tab and indent size value come from (for example, an empty Python file results in use of the defaults configured in preferences).

Conversion options for your file are given below the horizontal divider. The three tabs are used to select the type of conversion desired, and each tab contains information about the availability and action of that conversion, and a button to do the conversion. Most of these conversions have no parameters that can be altered by the user. Only in the case of conversion from tabs-only to spaces-only indentation styles, the tab size value shown in the indentation report is made editable, so that the configured default can be overridden.

Once conversion is complete, the indentation manager updates to display the new status of the file, and action of any subsequent conversions. Because the indentation manager updates each time its source file is edited, typing in a source window may slow noticeably when its indentation manager window is visible.

4.6 Auto-completion

When editing a Python file, the source editor will attempt to identify construct names as they are typed and will display a popup list of possible matches. Pressing the tab key while the list is displayed will complete the current word with the selected item from the list. Up and down arrow keys or their equivalent (for example, ctrl-p and ctrl-n in the default emacs keymap) can be used to navigate the popup list while it is visible. Auto-completion will abort upon typing the escape, ctrl-g, right/left arrow keys, any character that cannot be contained in an identifier (such as space), or initiation of any other command key sequence or after a period where nothing is typed into the editor.


   Auto-completion covers most but not all possible scenarios at this time. See the beginning of chapter 5 and section 5.7 for more information on current capabilities.

Until Python includes support for data typing, one way to get a lot more mileage out of the auto-completion facility is to use statements that assert variables as belonging to a specific class. An example is assert isinstance(obj, CMyClass). The code analysis facility will pick up on these and present you with the correct auto-completion values when you type obj. subsequently. An added bonus is that your code will catch errors in expected variable types in more cases.


4.7 Auto-save

The source code editor auto-saves files to disk every few seconds. The autosave failes are placed in a subdirectory of your Wing user directory (~/.wingide/autosave on Linux or WINGHOME\profiles\[username]\autosave on Windows). If Wing ever crashes or is killed from the outside, you can use these files to recover any unsaved changes. It is usually safe to copy the autosave files to overwrite the older unsaved files, but you may want to do a comparison first to verify that the autosave file is what you want.

4.8 Notes on Copy/Paste

There are a number of ways to copy and paste text in the editor:

It's important to note which actions use the system-wide clipboard, which use the emacs kill buffer (emacs mode only), and which use the X windows selection (X Windows only). Otherwise, these commands are interchangeable in their effects.


4.9 Auto-reload of Externally Changed Files

Wing's editor detects when files have been changed outside of the IDE and can reload files automatically, or after prompting you for permission. This is useful when working with an external editor, or when using code generation tools that rewrite files.

Wing's default behavior is to automatically reload externally changed files that you have not yet been changed within Wing's source editor, and to prompt to reload files that have also been changed in the IDE.

You can change these behaviors by setting the value of the cache.unchanged-reload-policy and changed-reload-policy preferences, as described at the end of section 4.14.

On Windows, Wing uses the change signal capability of the OS to detect changes so notification or reload is usually instant. On Linux, Wing polls the disk by default every 3 seconds; this frequency can be changed with the cache-reload-freq preference.


4.10 Normal Editor Personality


   Wing's source code editor can run with different personalities, either as a normal basic text editor, or as an emacs-like editor that is readily controlled with keyboard-driven commands.

The default personality for Wing is 'normal'. This uses only the graphical user interface for interacting with the editor and doesn't make use of any complex keyboard-driven command interaction.

The editor runs in normal mode when the edit.personality preference is set to normal. See section 2.1 of the Customization chapter for more information on how to alter your preferences.

In normal mode, the editor provides the following keyboard equivalents, which are defined in the default normal mode key mapping in file WINGHOME/keymap.normal.

4.10.1 Cursor Movement




Key Combination Command Description
shift + arrow keys previous-line-extend, next-line-extend, backward-char-extend, forward-char-extend Move cursor in indicated direction, extending the current text selection.
shift-page-up and shift-page-down forward-page-extend, backward-page-extend Move forward or backward a page, extending the current text selection.
ctrl-right-arrow and ctrl-left-arrow backward-word, forward-word Move cursor backward or forward a word. These can be combined with shift key for extension of selection.
home and end beginning-of-line, end-of-line Move cursor to beginning or end of line. Repeated home on an indented line will alternate between the absolute beginning and end of indentation. These can be combined with shift key for extension of selection.
ctrl-home and ctrl-end start-of-document, end-of-document Move cursor to beginning or end of document. These can be combined with the shift key for extension of selection.

4.10.2 Indentation

Key Combination Command Description
tab indent-to-match Indent the current line or selection to match the preceding non-blank line, adding or subtracting indentation as appropriate. See section 4.5 above for more information on indentation behavior.
ctrl-tab forward-tab Insert a forward tab character.
shift-tab backward-tab Insert a backward tab character.
ctrl-shift-greater indent-region Increase indent of the current line or selected region by one level of indentation.
ctrl-shift-less outdent-region Decrease indent of the current line or selected region by one level of indentation.

4.10.3 Commenting and Justification

Key Combination Command Description
ctrl-slash comment-out-region Comment out the selected region of code. This operates on whole lines, extending the current selection as necessary.
ctrl-shift-question uncomment-out-region Undo commenting out the selected region of code. This operates on whole lines, extending the current selection as necessary.
ctrl-j fill-paragraph Rejustify the paragraph of text at the current selection's starting position. This operates on whole lines, and is most useful for formatting comments, long strings, or documentation. Set the column at which to wrap with the edit.text-wrap-column preference.

4.10.4 Insertion and Deletion

Key Combination Command Description
delete forward-delete-char Delete the character in front of the cursor, or the current selection if not empty.
ctrl-delete forward-delete-word Delete the word in front of the cursor.
insert toggle-overtype Alternate between overtype and insert mode.
ctrl-backspace or alt-backspace or alt-delete backward-delete-word Delete the word behind the cursor.
ctrl + keypad plus and minus keys zoom-in, zoom-out Zoom text in and out by increasing and decreasing font sizes.

4.10.5 Undo and Clipboard

Key Combination Command Description
ctrl-z undo Undo most recent edit.
ctrl-y redo Redo most recent undone edit.
ctrl-x cut Cut the current selection to clipboard.
ctrl-c copy Copy the current selection to clipboard.
ctrl-v paste Paste from clipboard, replacing the current selection.
ctrl-a select-all Select the entire document.

4.10.6 File and Window Control

Key Combination Command Description
ctrl-o open Open a new document from disk.
ctrl-s save Save the current document to disk.
alt-d delete-window Close the current window.

4.10.7 Search and Replace

Key Combination Command Description
ctrl-f search-forward Initiate search in current document.
ctrl-r query-replace Initiate search/replace in current document.
ctrl-l goto-line Jump to a selected line number.
ctrl-e or ctrl-] brace-match Select the region between the nearest braces or defining the inner most code block reached from current cursor position.
ctrl-right-click goto-selected-symbol-defn Jump to point of definition of the symbol clicked on. This does not always succeed, as described at the beginning of chapter 5.

4.10.8 Macros

Key Combination Command Description
ctrl-shift-( start-kbd-macro Start recording a macro (will contain any keystrokes and commands issued to the editor).
ctrl-shift-) stop-kbd-macro Stop recording current macro and store it.
ctrl-m execute-kbd-macro Execute most recently defined keyboard macro relative to current cursor position.

See the section 2.2.3 for information on how to alter or replace this mapping.


4.11 Emacs Emulation

When preference edit.personality is set to 'emacs', the editor will run in a mode that emulates many emacs behaviors. In this mode, key strokes can be used to control most of the editor's functionality, using a textual interaction 'mini-buffer' at the bottom of the editor window where the current line number and other informational messages are normally displayed.

When in emacs mode, the editor supports the following key combinations for access to commands.

4.11.1 Cursor Movement




Key Combination Command Description
shift + arrow keys previous-line-extend, next-line-extend, backward-char-extend, forward-char-extend Move cursor in indicated direction, extending the current text selection.
ctrl + space bar set-mark-command Set selection start to current position and start automatically selecting from that point as the cursor is moved with arrow keys, page up/down, search commands, or in other ways.
ctrl-g stop-mark-command Cancel selecting a range, as initiated by set-mark-command, and set the cursor position to the end of the range.
home and end or ctrl-a and ctrl-e beginning-of-line, end-of-line Move cursor to beginning or end of line. Repeated home on an indented line will alternate between the absolute beginning and end of indentation. These can be combined with shift key for extension of selection.
ctrl-n and ctrl-p next-line and previous-line Move cursor to next or previous line.
ctrl-b and ctrl-f backward-char and forward-char Move cursor backward or forward one character.
ctrl-v and alt-v forward-page and backward-page Move forward or backward one page.
ctrl-home and ctrl-end start-of-document, end-of-document Move cursor to beginning or end of document. These can be combined with the shift key for extension of selection.
ctrl-l center-cursor Center the cursor on screen.

4.11.2 Indentation

Key Combination Command Description
tab indent-to-match Indent the current line or selection to match the preceding non-blank line, adding or subtracting indentation as appropriate. See section 4.5 for more information on indentation behavior.
ctrl-c shift-> indent-region Increase indentation of the currently selected range of lines (or current line when selection is empty) by one indentation level.
ctrl-c shift-< outdent-region Reduce indentation of the selected range of lines (or current line when selection is empty) by one indentation level.
ctrl-tab forward-tab Insert a forward tab character.
shift-tab backward-tab Insert a backward tab character.

4.11.3 Commenting and Justification

Key Combination Command Description
ctrl-c c or ctrl-c shift-numbersign comment-out-region Comment out the selected region of code. This operates on whole lines, extending the current selection as necessary.
ctrl-c u uncomment-out-region Undo commenting out the selected region of code. This operates on whole lines, extending the current selection as necessary.
escape q or ctrl-j fill-paragraph Rejustify the paragraph of text at the current selection's starting position. This operates on whole lines, and is most useful for formatting comments, long strings, or documentation. Set the column at which to wrap with the edit.text-wrap-column preference.

4.11.4 Insertion and Deletion

Key Combination Command Description
ctrl-d forward-delete-char Delete the character in front of the cursor, or the current selection if not empty.
ctrl-delete or alt-d forward-delete-word Delete the word in front of the cursor.
delete clear Delete current selection, if any.
insert toggle-overtype Alternate between overtype and insert mode.
ctrl-backspace or alt-backspace or alt-delete backward-delete-word Delete the word behind the cursor.
ctrl + keypad plus and minus keys zoom-in, zoom-out Zoom text in and out by increasing and decreasing font sizes.

4.11.5 Undo and Clipboard

Key Combination Command Description
ctrl-/ or ctrl-x u undo Undo the most recent edit action.
ctrl-w or shift-delete cut Cut the current selection to system-wide clipboard.
alt-w or ctrl-insert copy Copy the current selection to system-wide clipboard.
ctrl-y or shift-insert paste Paste from system-wide clipboard, replacing any current selection.
ctrl-k kill-line Remove the current line after the cursor point and place it into the kill buffer. Groups of lines deleted this way can be pasted subsequently with yank-line (ctrl-y). This is kept seperate from the system-wide clipboard and (on X windows) from the current selection. This command removes the newline only if there is no visible character on the line after the cursor.
ctrl-y yank-line Paste the current contents of the kill buffer, created with one or more adjacent kill-line commands, replacing any current selection. If the kill buffer is empty, the contents of the system-wide clipboard is pasted instead.

4.11.6 File and Window Control

Key Combination Command Description
ctrl-x ctrl-c quit Quit the application, first prompting to save any unsaved documents.
ctrl-x ctrl-s save Save current file to disk.
ctrl-x k kill-buffer Close the current file, prompting to save if necessary.
ctrl-x ctrl-f open Open a file from disk. Enter the filename at prompt, optionally using the tab key to auto-complete the current entry. Two tabs in a row will display a list of possible matches; continue typing or click on a match as desired. You can also use the up/down arrow keys to scroll through recently-opened files. Hitting enter opens the selected file. Exit without opening with ctrl-g or esc.
ctrl-x i insert-file Insert a file at current cursor position. Interaction is the same as for the open command.
ctrl-x b switch-document Switch to another document. Hit enter to select the specified default, type file name fragments (tab and double-tab can be used for completion and viewing list of matches), or use the up/down arrow keys to scroll through a list of options. Enter accepts and switches; escape or ctrl-g aborts.
ctrl-x 5 0 delete-window Close the current editor window.


4.11.7 Search and Replace

Key Combination Command Description
ctrl-s search-forward Initiate interactive incremental forward search. The search is case sensitive if you type any capital letters; otherwise case-insensitive. Exit search by using arrow keys or other commands, or abort (returning to original position) with ctrl-g or esc.
ctrl-r search-backward Initiate interactive incremental backward search. Acts like forward search, only proceeds backward in source.
alt-shift-percent or escape shift-percent query-replace Initiate interactive query/replace. First type search string, then replace string and respond to prompts with 'y' and 'n'. You may use the tab key to auto-complete values you type into the search and replace strings. End the session with ctrl-g or escape.
alt-g or alt-l or escape g goto-line Go to a specific line; enter the line number at prompt.
ctrl-b brace-match Select all text within the innermost braces from current cursor position.
ctrl + mouse-button-3 goto-selected-symbol-defn Jump to point of definition of the symbol clicked on. This does not always succeed, as described at the beginning of chapter 5.

4.11.8 Macros

Key Combination Command Description
ctrl-x shift-( start-kbd-macro Start recording a macro (will contain any keystrokes and commands issued to the editor).
ctrl-x shift-) stop-kbd-macro Stop recording current macro and store it.
ctrl-x m execute-kbd-macro Execute most recently defined keyboard macro relative to current cursor position.
escape + numbers initiate-repeat-* Start entering a repeat value which will cause the immediately following command or keystroke to be executed the specified number of times. Use esc or ctrl-g to abort. This is particularly useful to execute a keyboard macro multiple times in a row.

4.11.9 Debugging

Key Combination Command Description
ctrl-c ctrl-c debug-continue Start debugging the main project debug file, stopping at the first encountered breakpoint.
ctrl-c ctrl-s debug-stop Stop the current debug session at current run position, as if at a breakpoint.
ctrl-c ctrl-k debug-kill Stop and end the current debug session.
ctrl-x space break-toggle Add a regular breakpoint at current line of code if there isn't one already, or remove the existing breakpoint.

4.11.10 Other

Key Combination Command Description
alt-x or escape x command-by-name Enter a command by name for execution. Use the tab key for auto-completion or double-tab to see a list of possible matches. Up/down arrow keys also work for scrolling through recent commands. Hit enter to execute the command or esc or ctrl-g to abort.
ctrl-c ctrl-d show-debug-window Show the debugger window. This is not a usual emacs editor key binding.
ctrl-c ctrl-b browse-project-modules Show the source code browser window. This is not a usual emacs editor key binding.
ctrl-c ctrl-p show-project-window Show the project manager window. This is not a usual emacs editor key binding.
ctrl-c ctrl-e show-error-list Show the debugger error list window. This is not a usual emacs editor key binding.

Many of these commands are also available through menu items. See section 2.2.3 for information on how to alter or replace this mapping.

4.12 Search/Replace

All editor modes include a graphical search/replace manager, which can be brought up with the Search Manager item in the Edit menu. Commands in this window will apply to the current (most recently at front) source view.

To use this manager, enter search and optionally replace text, set search options, and control the search/replace process with the provided buttons.

Replace actions can always be undone, including Replace All.

Emacs mode additionally provides ctrl-s and ctrl-r incremental search, and query-replace facilities, as described in section 4.11.7 above.

4.13 Keyboard Macros


   The Edit menu contains items for starting and completing definition of a keyboard or command sequence macro, and for executing the most recently defined macro. Once macro recording is started, any keystroke or editor command is recorded as part of that macro. Most commands listed in sections 4.10 and 4.11 above may be included in macros, as well as all character insertions and deletions.

The keyboard macro feature is currently most useful in emacs mode, where powerful cursor-relative macros can be built for repetitive reformatting tasks. This is done by combining incremental search with cursor movement and typing.

4.13.1 Example (in Emacs mode)

A common task when writing Python bindings for C/C++ libraries is copying lists of #define constants and converting them into Python variable assignments.

#define SC_MARK_CIRCLE 0
#define SC_MARK_ROUNDRECT 1
#define SC_MARK_ARROW 2
#define SC_MARK_SMALLRECT 3
#define SC_MARK_SHORTARROW 4
#define SC_MARK_EMPTY 5
#define SC_MARK_ARROWDOWN 6
#define SC_MARK_MINUS 7
#define SC_MARK_PLUS 8
       

In emacs mode, the above can be converted by positioning the cursor before the first #define, starting macro definition, and executing the following keystrokes:


escape 8 ctrl-d ctrl-s <space> <right arrow> = <space> ctrl-a <down arrow>

This deletes the 8 characters '#define ' (with trailing space) in front of the cursor, jumps to the space after the constant identifier, inserts '= ', and moves to the beginning of the next line. When this is complete, stop macro recording and type the following to convert the remaining lines:


escape 8 ctrl-x e

This will execute the macro eight times resulting in the following reformatted source (the first line was reformatted during the creation of the macro):

SC_MARK_CIRCLE = 0
SC_MARK_ROUNDRECT = 1
SC_MARK_ARROW = 2
SC_MARK_SMALLRECT = 3
SC_MARK_SHORTARROW = 4
SC_MARK_EMPTY = 5
SC_MARK_ARROWDOWN = 6
SC_MARK_MINUS = 7
SC_MARK_PLUS = 8
       

Combine this technique with ctrl-space (set-mark-command) and copy/paste to alter the order of constructs within a line. Be creative... and don't forget that undo can be used to fix problems caused by incorrect macros or bad cursor position before executing a macro.

Macros will terminate if any command within the macro fails (for example, if an incremental search fails). This can be used to prevent edits when a macro is executed in a location where it doesn't make sense.

4.13.2 Repetition


   In emacs mode, macros can be executed over and over again by using the escape + numbers key board interaction to set up a repetition count before executing the macro. For example, type 'escape 1 0 ctrl-x e' in emacs mode to execute a macro ten times in a row.


4.14 Preferences

The following preferences are defined for the editor:

The following additional preferences that control reloading of file caches are also relevant:

You need to quit and restart Wing before any changes in these preferences take effect.


next up previous contents
Next: 5. Source Code Browser Up: Wing IDE Reference Manual Previous: 3. Project Manager   Contents


Stephan R.A. Deibel
2001-09-17