Istvan wrote:
Kein-Hong Man wrote:
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.

Try this:
  editor.TargetStart = editor:PositionFromLine(0)
  editor.TargetEnd = editor.LineEndPosition[0]
  editor:ReplaceTarget("# Modified: "..os.date('%Y-%m-%d %H:%M:%S'))

That works fine!
Now one think I don't like, after a Save, when do a Undo then I must undo 2 times to undo the last operation. First will undo the addition for "# Modified ..." and
the second will undo the last operation.
Howe could I stop recording the undo operation for the writing of "# Modified ..."?

Bracket with the following (barely tested):

  editor.UndoCollection = false
  -- edit stuff here
  editor.UndoCollection = true

HTH,
--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia

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

Reply via email to