光标位置

This commit is contained in:
Liang Ding 2014-09-11 15:15:29 +08:00
parent 15c03a6a4a
commit 9c70ebc4bf
2 changed files with 12 additions and 2 deletions

View File

@ -172,6 +172,15 @@ var editors = {
"Ctrl-D": "doNothing" // 取消默认的 deleteLine
}
});
editor.on('cursorActivity', function(cm) {
var cursor = cm.getCursor();
$("#footer-cursor").text('| ' + (cursor.line + 1) + ':' + (cursor.ch + 1) + ' |');
// TODO: 关闭 tab 的时候要重置
// TODO: 保存当前编辑器光标位置,切换 tab 的时候要设置回来
});
editor.setSize('100%', $(".edit-panel").height() - $(".edit-header").height());
editor.setValue(data.content);
editor.setOption("mode", data.mode);
@ -181,7 +190,7 @@ var editors = {
if ("text/x-go" === data.mode || "application/json" === data.mode) {
editor.setOption("lint", true);
}
if ("application/xml" === data.mode || "text/html" === data.mode) {
editor.setOption("autoCloseTags", true);
}

View File

@ -141,7 +141,8 @@
</div>
<div class="footer">
|
<span>|</span>
<span id="footer-cursor" style="float: right;"></span>
</div>
<script type="text/javascript">