Sorry for the late response.
I think what you want can be achieved by writing an action whose code
looks kind of like this:
// elsewhere in your .java file...
// in a method somewhere...
// pass the method a text area instance.
Buffer buffer = textArea.getBuffer();
Position composeMode = (Position)buffer.getProperty(
if(composeMode != null)
String text = buffer.getText(composeMode.getPosition(),
// do something with 'text', call buffer.remove(),
// call buffer.insert(), ...
// then in your actions.xml...
This is somewhat simplified but you should be able to get the general
idea. If you need more help it might be better to ask on the #jedit IRC
On Wed, 2002-12-18 at 20:54, Leston Buell wrote:
> Hi. I have an idea for a plugin which i would find useful, but i'm not a
> professional programmer and haven't written anything in Java for three
> years. So, i need a bit of advice on getting started.
> Here's the idea. I'd like to create a Unicode Compose plugin which would
> work in a way similar to (but more sophisticated than) the Compose
> function in WordPerfect 5.1 for DOS, if anyone besides me remembers
> that! The purpose of the plugin is to allow the user a way to type in
> Unicode characters which are not accessible from the keyboard. Here's
> how it would work:
> 1. User presses a control key which activates Compose mode.
> 2. User types one of a predefined sequence of ASCII characters,
> say "trademark" or "C^".
> 3. A Unicode symbol appears at the insert point in the
> current buffer, in these cases the trademark symbol
> or an upper case letter "C" with a circumflex.
> 4. User is returned to normal input mode.
> When all finished, the plugin would allow user-defined ASCII character
> combinations and Unicode replacement characters (or strings) and the
> ability to switch between character replacement schemes. (For example,
> toggle between Cherokee, Russian, and Esperanto input schemes.)
> My question is what mechanism would be used to capture keystrokes in the
> buffer editing pane and modify what actually gets written in the pane?
> Is there a way for the plugin to add itself as an EventListener to the
> editing pane? Would it then be possible to intercept key events,
> preventing the default action for some of them but not for others? I
> think that input modes for particular programming languages must do
> something like this, since hitting a closing bracket, for example,
> sometimes results in an indented bracket rather than just a bracket.
> What mechanism is used to achieve this behavior?
> To simplify the problem a bit. Let's say i want to write a (brilliant,
> if i do say so myself) plugin which would write the character "b" to the
> current buffer whenever the user typed the character "a" but which would
> let any other keystroke use its default behavior. What would be my
> strategy here?
> Thanks in advance for being patient with a novice.
> This SF.NET email is sponsored by: Order your Holiday Geek Presents Now!
> Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap,
> MP3 Players, XBox Games, Flying Saucers, WebCams, Smart Putty.
> T H I N K G E E K . C O M http://www.thinkgeek.com/sf/
Slava Pestov <slava@...>