home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1997-1998 - Modelworks Software
-
- /**
- @Tool: completeBracket~inserts a closing bracket and places
- the caret on the next line. Defined for all file types.
- Typing <code>[<tab></code> results in:
- <code>
- [
- <caret>
- ]
- </code>
- @EndTool:
- @Summary: completeBracket~inserts a closing brace
- */
-
- function DoCommand()
- {
- var path = File.getToolsPath() + "\\Smartkeys\\completeBracket.script";
- Application.registerSmartKeyHandler("*", "[\t", path,
- "Complete: [<tab> with [<new line><new line>]");
- }
-
- function OnEvent(editor,lineBuffer)
- {
- var selection = editor.getSelection();
- editor.insert(selection.startLineIndex, selection.startCharIndex,
- "\n\n]");
-
- var currentIndentLevel = editor.getIndentLevel(selection.startLineIndex);
- editor.setIndentLevel(selection.startLineIndex + 1,
- currentIndentLevel + 1);
- editor.setIndentLevel(selection.startLineIndex + 2,
- currentIndentLevel);
-
- editor.select(selection.startLineIndex + 1, 32000,
- selection.startLineIndex + 1, 32000);
-
- editor.setActive("Complete Bracket");
- return true;
- }
-
- !!/Script
-
-
-