Ok, so let's say, that I would like to react in some way if I have a cursor
after letter 'a' and I press ENTER. So I write something like that:
function test(){
        var ed = newEditor();
        try{ed.assignActiveEditor();}catch(e){return;}
        ed.command("ecLeft");
        if(ed.selText()=='a'){
                ed.selText('Haha, theres "a" in here!');
        }
        ed.command("ecLineBreak");
}

function Init(){
        addMenuItem("test", "test", "test", "ENTER");
}

Everything is fine as long as I'm editing a file. After pressing ENTER I get
some text, or not, but I always have my line broken.
But there's a problem, when I want to edit project name:
[URL=http://img135.imageshack.us/my.php?image=pspadts0.png][IMG]http://img135.im
ageshack.us/img135/5632/pspadts0.th.png[/IMG][/URL]

To confirm new name I press ENTER and this is where script is being launched,
but shouldn't be. Name isn't confirmed and somewhere in 10th line appears new
line.

I hope it's clearer now.

-- 
<http://forum.pspad.com/read.php?2,42872,42937>
PSPad freeware editor http://www.pspad.com

Odpovedet emailem