Hi,

I recently ran into a somehow similar problem with PSPad, when I discovered that
using the _Enter-key_ on Clips completion-boxes doen't work as suggested
for me.

After some hunting for the possible cause of this odd behaviour, I discovered
that one "*Ruby completion*" VBS script I installed from the inet was the
cause of *all evil* here (see below the VBS script I'am talking about).


...
...
sub RubyCodeCompletion
  Set editor = newEditor()
  Set regEx = New RegExp

  editor.assignActiveEditor
  file = editor.fileName
  regEx.Pattern = ".rb"   ' Only when the file is a ruby file.
  matched = regEx.Test(file)
  if matched Then
    matched = matched
  else
    editor.command "ecLineBreak"
    exit sub
  end if
  
  sel = editor.lineText
  regEx.Pattern =
"^\s*(class)|(def)|(while)|(if)|((.*\s+)?do\s*(\|\s*[a_zA_Z0_9_]+\s*\|)?)"
  matched = regEx.Test(sel)
  if matched Then
    editor.command "ecLineEnd"
    editor.command "ecLineBreak"
    editor.command "ecLineBreak"
    editor.lineText editor.lineText & "end"
    editor.command "ecUp"
    editor.command "ecTab"
  else
    editor.command "ecLineBreak"
    exit sub
  end if
end sub

sub Init      ' Set key binding
  addMenuItem "Ruby completion", "Code Completion", "RubyCodeCompletion" ,
"Enter"
  'addMenuItem "", "", "RubyCodeCompletion" , "Enter"
end sub


The problem with this script too is, that it commonly (re)assigns the
_Enter_-key and thus it seems to overwrite the Enter-key behaviour of the
PSPad Clips completion popup list.

As far as you perform usual typing and no other special editor action etc.
inside PSPad the above script works, but as mentioned above, it has [i]bad side
effects[/i] on things like the Clips Enter-selection itself.

What I wonder about is, that PSPad seems not to have or offer any editor
scripting methods/functions, which allow to distinguish if the editor is
actually possibly inside some action state like the completion etc. What I mean
is, I miss some sort of "_is*InSomeActionState*?_" methods, which
would allow to first prove if it is actually safe to perform certain other
editor tasks and thus lower possibly unwanted side effects.

Usually I would say, it would be of an advantage and maybe powerfull, to be able
to also hook on some external scripts with some common editing keys. But only as
far as one has the ability to eliminate possible unwanted side effects here.
Actually, even I'am a freshman with PSPad and it's scripting capabilities, I
don't see any PSPad function help in this direction.

[i]Don't know if I expressed the problem, as I see it related to this theme well
enough, but I hope you will catch the main sense.[/i]

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

Odpovedet emailem