Cay Horstmann wrote:
> I write about computer programming, and I often use the tt font.
> 
> When I am at the END of a (text) block, I type
> 
>    Ctrl+I t t Enter (my stuff) Ins
> 
> and go on with regular text.

Often do that too.



> When I am in the MIDDLE of a (text) block, I type
> 
>    Ctrl+I t t Enter (my stuff) Right
> 
> That is, Right instead of Ins.

Never do that. (If I really needed to do that, I would have used Tab
instead of Right: much more convenient due to the location of the Tab key.)



> I find it bothersome that I have to remember where I am. I'd rather hit
> Ins in both cases.
> 
> But Ins does nothing if I am at the end of a tt element and there is a
> (text) block as its next sibling.
> 
> Would it be possible to overload the semantics of Ins so that it does
> the right thing in this situation?

We'll have to think about your suggestion. For now, please copy this
very simple macro[*] to your customize.xxe, restart XXE, and you'll be done:

---
  <binding>
    <keyPressed code="INSERT" />
    <command name="insertTextAfterOrMoveDot" />
  </binding>

  <command name="insertTextAfterOrMoveDot">
    <macro>
      <choice>
        <command name="insertNode"
                 parameter="textAfter[implicitElement]" />
        <command name="moveDotTo"
                 parameter="nextTextNode" />
      </choice>
    </macro>
  </command>
---

---
[*] Could be improved to test if next sibling is really a text node.


Reply via email to