Chachereau Nicolas:

One thing I'd like to see is an OnChange event. I think I saw something
similar mentioned in the interface, but afaik it is not implemented for Lua.

  Scintilla's SCN_MODIFIED notification occurs very frequently: in a
Replace All operation it may be called multiple times for each
replace. Running a Lua function on each SCN_MODIFIED may be quite
slow. Even checking whether there is a Lua OnChange function may be
too slow.

A use case would be a script for HTML editing that updates the closing tag
whevener the starting tag changes. I wrote this in Lua, and try to detect 
changes
with the OnChar event. It works quite well, but it isn't perfect. For example,
you might mistype something, say you want to change a <p> into a <div>, and you
type 'divb' while overwriting the 'p'. My script will update the closing tag to
be </divb>. You then press backspace to delete the 'b', but my script can't 
detect
it and can't update the closing tag. (The workaround is to do backspace twice
and type the 'v' again).

  You can't change the document text inside a SCN_MODIFIED
notification: you would have to arrange for something to be called
later to perform the change. That then would need an  OnIdle or
OnDeferred or similar function for Lua. Simplest way to achieve your
feature is to bind the backspace key to your own function.

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

Reply via email to