So now what is the best way to edit lines? for example, if I want to
go though a group of lines and apply substr() or replace() on them.
I tried:
// no workie
this.code[i] = this.code[i].replace(regex,"");
// works, but it seems to get ymacs confused:
this._replaceLine(i,this.code[i].substr(toremove));
or
this._replaceLine(i,this.code[i].replace(regex,""));;
thanks,
-joe
this.cmd("delete_region", begin, end);
this.cmd("goto_char", position_for_insertion);
this.cmd("insert", text_to_insert);
Or the more direct (these should be public API in fact):
this._deleteText(begin, end);
this._insertText(text_to_insert, position_for_insertion);
this._replaceText(begin, end, replacement_text);
It's pretty awkward to use these for line-by-line changes, but you can
do this instead:
var text = this._bufferSubstring(begin, end);
var new_text = do_something_on(text);
this._replaceText(begin, end, new_text);
HTH.
-Mihai
> --
> www.ymacs.com - AJAX code editor
--
Mihai Bazon,
http://mihai.bazon.net/blog