Chachereau Nicolas schrieb:
Steve Donovan wrote:
Well it was a new bug for me! Curiously enough, this doesn't happen on
Windows. The fix is to be more careful about return values from Lua
event handlers.

This is actually related to another bug, for which I had a fix I've
wanted to send for a long time. If you sent both a handler for
OnOutputLine and for OnEditorLine, then each handler is called twice
every time the event occurs, as demonstrated by this little script:
(try it with an extman without the fix Steve just sent)

scite_OnEditorLine(function()
  print("EditorLine")
end)

scite_OnEditorLine(function()
  print("EditorLine2")
end)

scite_OnOutputLine(function()
  print("OutputLine")
end)

If you press Enter in the output pane, you'll see "OutputLine" twice.
If you press Enter in the editor, you'll see both "EditorLine" and
"EditorLine2" twice. This is because on_line_char only tested in which
pane it was and not whether it was the pane it was asked for. My fix
was a little bit different:

local function on_line_char(ch,handler,pane,result)

  if ch == '\n' and pane.Focus then

    DispatchOne(handler, grab_line_from(pane))

    return result

  end

  return false

end



local function on_line_editor_char(ch)

  return on_line_char(ch,_LineEd,editor,false)

end



local function on_line_output_char(ch)

  return on_line_char(ch,_LineOut,output,true)

end

It doesn't make a big difference, actually.

Nicolas


thanks a lot!

both fixes solved the problem

markus

_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to