Menu

#122 KeyEvents passed on to InputHandler (jEdit 2.6pre4)

normal bug
closed-fixed
5
2000-08-29
2000-08-28
Scott Wyatt
No

Hi,

I am trying to create a database plugin. I am using a JTextArea to provide user input for executing queries. Basically, the user types the query in the textarea and hits an execute button. The problem is that all key events processed within my textarea are passed up to the main jEdit textarea. This can be problematic for events like backspace because not only does it delete from my textarea, but it also deletes from jEdit's textarea. I fixed this problem by modifying the DefaultInputHandler to only process key events generated from jEdit's textarea, but I do not know if that is the correct way to handle this. I just do not think it would be a good idea for every plugin to have to handle consuming key events so that jEdit's textarea does not receive them. This only happens when the plugin is docked using the new Docking API. I am using jEdit 2.6pre4/jdk1.3/Winnt.

Scott

Discussion

  • Slava Pestov

    Slava Pestov - 2000-08-29
    • assigned_to: nobody --> spestov
    • labels: 102670 --> editor core
     
  • Slava Pestov

    Slava Pestov - 2000-08-29

    While your suggested fix is one possibility, I'd rather not do that. The focus shouldn't have to be in the text area so that C+q can be pressed, etc. A better fix would be to divide keyboard shortcuts into two groups; 'global' shortcuts, and 'text area specific' shortcuts. The 'global' shortcuts would not include backspace, the arrow keys, and other keys that could cause problems. Any thoughts? This is a hard one to fix.

     
  • Scott Wyatt

    Scott Wyatt - 2000-08-29

    I think your suggestion is the best way to handle this. Its just a matter of splitting the shortcuts, which could be a pain to implement. Maybe creating a DockableInputHandler class which can be used to consume all shortcuts that apply to jEdit's textarea only. This could be applied to the DockableWindowContainer class against the JTabbedPane. This would tend to make some sense in that this problem should only present itself to docked plugins. Just a suggestion, but I do not know if this is the best way to implement the shortcut split.

    Scott

     
  • Slava Pestov

    Slava Pestov - 2000-08-29

    I fixed it in a completely different and much more elegant way. The top-level key handler in the View class ignores the event if it originated from a JTextComponent that can handle that event. This solves the problem.

     
  • Slava Pestov

    Slava Pestov - 2000-08-29
    • status: open --> closed-fixed
     

Log in to post a comment.