How to start statusBar line number.

382 views
Skip to first unread message

HyunJong Cho

unread,
Jul 24, 2016, 6:51:49 PM7/24/16
to Ajax.org Cloud9 Editor (Ace)

I want to change status line number 0 to 1.


So, i try this code

"editor.setOption('firstLineNumber', 1);"

But don't change line number.


How to change the StatusBar line number.






Harutyun Amirjanyan

unread,
Jul 26, 2016, 6:12:43 PM7/26/16
to ace-d...@googlegroups.com
Currently that is not supported, You'll need to override statusBar.updateStatus function https://github.com/ajaxorg/ace/blob/v1.2.3/lib/ace/ext/statusbar.js#L38

--
You received this message because you are subscribed to the Google Groups "Ajax.org Cloud9 Editor (Ace)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ace-discuss...@googlegroups.com.
To post to this group, send email to ace-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/ace-discuss.
For more options, visit https://groups.google.com/d/optout.

YellowAfterlife

unread,
Sep 23, 2016, 10:13:00 AM9/23/16
to Ajax.org Cloud9 Editor (Ace)
Here's a sample of the tweaked function for that, should anyone seek
(function enableStatusBar() {
var statusBar = document.getElementById("ace_status-bar");
//
var lang = ace.require("ace/lib/lang");
var statusUpdate = lang.delayedCall(function(){
this.updateStatus(editor)
}.bind(this)).schedule.bind(null, 100);
var statusUpdate = lang.delayedCall(function(){
var status = [];
function add(str, separator) {
str && status.push(str, separator || " | ");
}
//
add(editor.keyBinding.getStatusText(editor));
if (editor.commands.recording) add("REC");
//
var sel = editor.selection;
var c = sel.lead;
//
if (!sel.isEmpty()) {
var r = editor.getSelectionRange();
add("(" + (r.end.row - r.start.row) + ":"  +(r.end.column - r.start.column) + ")", " ");
}
add("Ln: " + (c.row + 1) + " Col: " + (c.column + 1), " ");
if (sel.rangeCount) add("[" + sel.rangeCount + "]", " ");
status.pop();
statusBar.textContent = status.join("");
}.bind(this)).schedule.bind(null, 100);
editor.on("changeStatus", statusUpdate);
editor.on("changeSelection", statusUpdate);
editor.on("keyboardActivity", statusUpdate);
statusUpdate();
})();
Reply all
Reply to author
Forward
0 new messages