found how to get the modes

4 views
Skip to first unread message

Joe

unread,
Feb 11, 2010, 2:45:28 PM2/11/10
to Ymacs - AJAX code editor

P.modeStr = function () {
var s = this.modes.join(" ").replace(/_mode/g, "");
return "(" + s + ")"
}


var ml = String.buffer("--", this.isModified(), "- <b>",
this.name.htmlEscape(), "</b> (", rc.row + 1, ",", rc.col, ")--",
this.modeStr(), "--");

Now just need to find out how many lines are in a buffer.

thanks,
-joe

Mihai Călin Bazon

unread,
Feb 11, 2010, 11:00:33 PM2/11/10
to ym...@googlegroups.com
Use this.code.length to get the number of lines. (where *this* is an
Ymacs_Buffer).

Cheers,
-M.

> --
> www.ymacs.com - AJAX code editor

--
Mihai Bazon,
http://mihai.bazon.net/blog

Joseph McDonald

unread,
Feb 11, 2010, 11:18:56 PM2/11/10
to ymacs
2010/2/11 Mihai Călin Bazon <mihai...@gmail.com>:

> Use this.code.length to get the number of lines. (where *this* is an
> Ymacs_Buffer).

Thanks!

Now have "percentage" in the modeline:
P.percentBuf = function() {
var percent = parseInt(((this._rowcol.row+1)/this.code.length)*100);
return "(" + percent + "%)";
}
/*... */


var ml = String.buffer("--", this.isModified(), "- <b>",
this.name.htmlEscape(), "</b> (", rc.row + 1, ",", rc.col,

")--",this.percentBuf(), "--", this.modeStr(), "--");

-joe

Reply all
Reply to author
Forward
0 new messages