Istvan wrote:
I wish to write a lua script which add this text:
Last Modified: 2006.02.01
at the top of the edited file when I save it.
I use OnSave() and I could add the text with these lines:
addtext="# Modified: "..os.date('%Y-%m-%d %H:%M:%S').."\r\n"
editor:InsertText(0,addtext)
It works well, without leaving the current position of the editor.
But my concern is that I couldn't update the text without jumping to
begin of
the page. I tried editor:remove (and then insert again), but it jumped
to begin of file.
Is there any way to update a text without jumping from the current
position?
Try this:
editor.TargetStart = editor:PositionFromLine(0)
editor.TargetEnd = editor.LineEndPosition[0]
editor:ReplaceTarget("# Modified: "..os.date('%Y-%m-%d %H:%M:%S'))
HTH,
--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia
_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest