summaryrefslogtreecommitdiff
path: root/js/codeq
diff options
context:
space:
mode:
Diffstat (limited to 'js/codeq')
-rw-r--r--js/codeq/editor.js33
1 files changed, 14 insertions, 19 deletions
diff --git a/js/codeq/editor.js b/js/codeq/editor.js
index f84bd05..d0b365e 100644
--- a/js/codeq/editor.js
+++ b/js/codeq/editor.js
@@ -1,28 +1,23 @@
codeq.makeEditor = function (elt, options) {
- var statusBar = document.createElement("div"),
+ var statusBar = $(elt).siblings(".block-statusbar")[0],
updateStatusBar = function (pos) {
statusBar.innerHTML = 'line ' + (pos.line+1) + ', column ' + (pos.ch+1);
},
- editor;
+ allOptions = $.extend({
+ cursorHeight: 0.85,
+ lineNumbers: true,
+ matchBrackets: true,
+ extraKeys: {
+ // replace tabs with spaces
+ Tab: function (cm) {
+ var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
+ cm.replaceSelection(spaces);
+ }
+ }
+ }, options),
+ editor = CodeMirror(elt, allOptions);
- options.cursorHeight = 0.85;
- options.lineNumbers = true;
- options.matchBrackets = true;
- options.extraKeys = {
- // replace tabs with spaces
- Tab: function (cm) {
- var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
- cm.replaceSelection(spaces);
- }
- };
- editor = CodeMirror(elt, options),
-
- //since addPanel brakes CodeMirrot responsiveness no mather what, we manually added block-statusbar located at the bottom of editor block
- //statusBar.className = 'editor-statusbar';
- statusBar = statusBar = $(elt).siblings(".block-statusbar")[0];
updateStatusBar({line: 0, ch: 0});
-
- //editor.addPanel(statusBar, {position: 'bottom'});
editor.on('cursorActivity', function (instance) {
var pos = instance.getDoc().getCursor();
updateStatusBar(pos);