Madlik, Monika (LNG-VIE) wrote:
> I tried to convert an ndash to an mdash with the following binding:
> 
> <cfg:binding>
>       <cfg:keyPressed code="SUBTRACT" modifiers="ctrl"/>
>       <cfg:command name="insertString" parameter="&#8212;"/>
> </cfg:binding>
> 
> But this shortcut doesn't work. When I press "CTRL + -" nothing happens.

---
<cfg:binding>
  <cfg:keyPressed code="MINUS" modifiers="ctrl"/>
  <cfg:command name="insertString" parameter="&#8212;"/>
</cfg:binding>
---

Works fine but you really need to have a '-' key on your keyboard. This
is the case one my French keyboard.

---
<cfg:binding>
  <cfg:keyPressed code="SUBTRACT" modifiers="ctrl"/>
  <cfg:command name="insertString" parameter="&#8212;"/>
</cfg:binding>
----

Works fine too, but you need to press the '-' key found on the *keypad*
(above the '+' key, next to the '*' key).



> In addition I'd like to know if it is possible to enter "--" in the
> editor and automatically get an mdash?

Sure. Here it is:
---
<command name="insertDash">
  <macro undoable="true">
    <choice>
      <sequence>
        <!-- In XPath, first offset in a string is 1 and not 0. -->
        <test expression="$dot and
                          $dotOffset &gt;= 0 and
                          substring($dot,$dotOffset,1) = '-'" />
        <command name="deleteChar" parameter="backwards" />
        <command name="insertString" parameter="&#8212;" />
      </sequence>

      <command name="insertString" parameter="-" />
    </choice>
  </macro>
</command>

<binding>
  <charTyped char="-" />
  <command name="insertDash" />
</binding>
---


Reply via email to