Thanks for reporting this bug. It is fixed now. Note that the variables passed to a macro are %0, %1, %2, etc. You need to write: --- <command name="convert" parameter="[wrapElement] %0"/> ---
David Flanagan wrote: > > XXE reports the following (non-fatal) exception when I try to run a > macro I'm developing. The macro is probably buggy, but I assume that > you don't want to throw exceptions even for buggy macros.... > > The macro, its key binding, and the exception are below. > > Note that the macro looks for a selection and if there is none, it first > selects the current word. Then it attempts to operate on the selection. > I only see the exception if there is no selection to begin with. The > current word does get selected, but nothing else happens. If I start > with a selection, then nothing happens. > > David > > <!-- If there is a selection, enclose it in the specified tag. --> > <!-- If there is no selection, do it to the current word. --> > <!-- XXX: add %2 & %3 for optional attribute name and value? --> > <command name="djf.Enclose"> > <macro> > <sequence> > <!-- if there is no selection, select the current word --> > <choice> > <sequence> > <pass><command name="djf.testSelection" parameter="none"/></pass> > <command name="selectText" parameter="word"/> > </sequence> > </choice> > > <!-- now insert the specified tag around the selection --> > <command name="convert" parameter="[wrapElement] %1"/> > </sequence> > </macro> > </command> > > <binding> <!-- Ctrl-C I: put word or selection in italics --> > <keyPressed code="C" modifiers="ctrl"/> > <keyPressed code="I"/> > <command name="djf.Enclose" parameter="emphasis"/> > </binding> > > ---------------------------------------- > Execution of command com.xmlmind.xmledit.command.MacroCommand > with parameter 'emphasis' > has thrown a java.lang.StringIndexOutOfBoundsException exception. > ---------------------------------------- > java.lang.StringIndexOutOfBoundsException: String index out of range: 0 > at java.lang.String.charAt(String.java:460) > at > com.xmlmind.xmledit.command.CommandUtil.toFieldChooserInfo(Comma> > -- > XMLmind XML Editor Support List > xmleditor-support at xmlmind.com > http://www.xmlmind.com/mailman/listinfo/xmleditor-support > > -- Hussein SHAFIE, hussein at pixware.fr, Pixware, Immeuble Capricorne, 23 rue Colbert, 78180 Montigny Le Bretonneux, France, Phone: +33 (0)1 30 60 07 00, Fax: +33 (0)1 30 96 05 23 ndUtil.java:149) > > at > com.xmlmind.xmledit.command.Convert.getFieldChooserInfo(Convert.java:188) > at > com.xmlmind.xmledit.command.Convert.prepareCommand(Convert.java:82) > at > com.xmlmind.xmledit.command.MacroCommand$Invocation.prepare(MacroCommand.java:90) > > > at > com.xmlmind.xmledit.command.MacroCommand$Sequence.execute(MacroCommand.java:202) > > > at > com.xmlmind.xmledit.command.MacroCommand.executeCommand(MacroCommand.java:245) > > > at > com.xmlmind.xmledit.gadget.Bindings.executeCommand(Bindings.java:532) > at > com.xmlmind.xmledit.gadget.Bindings.handleKeyEvent(Bindings.java:486) > at > com.xmlmind.xmledit.view.DocumentView.handleKeyEvent(DocumentView.java:3092) > > at > com.xmlmind.xmledit.gadget.EventDispatcher.dispatchEvent(EventDispatcher.java:132) > > > at > com.xmlmind.xmledit.view.DocumentViewEventDispatcher.dispatchEvent(Do

