Skip to content

Commit

Permalink
Merge pull request #1231 from ajaxorg/ui/cursor
Browse files Browse the repository at this point in the history
HOTFIX: Reset cursor color to Ace default
  • Loading branch information
sergi committed Apr 7, 2012
2 parents 37a5ce6 + 5b9561d commit 0736c06
Showing 1 changed file with 24 additions and 35 deletions.
59 changes: 24 additions & 35 deletions client/ext/vim/maps/util.js
Expand Up @@ -10,45 +10,34 @@ module.exports = {
currentMode: 'normal',
insertMode: function(editor) {
var _self = this;
var theme = editor && editor.getTheme() || "ace/theme/textmate";

ide.dispatchEvent("vim.changeMode", { mode : "insert" });

require(["require", theme], function (require) {
var isDarkTheme = require(theme).isDark;
_self.currentMode = 'insert';
// Switch editor to insert mode
editor.unsetStyle('insert-mode');

_self.currentMode = 'insert';
// Switch editor to insert mode
editor.unsetStyle('insert-mode');

var cursor = document.getElementsByClassName("ace_cursor")[0];
if (cursor) {
cursor.style.display = null;
cursor.style.backgroundColor = null;
cursor.style.opacity = null;
cursor.style.border = null;
cursor.style.borderLeftColor = isDarkTheme? "#eeeeee" : "#333333";
cursor.style.borderLeftStyle = "solid";
cursor.style.borderLeftWidth = "2px";
}
var cursor = document.getElementsByClassName("ace_cursor")[0];
if (cursor) {
cursor.removeAttribute("style"); // fall back to ace theme
}

editor.setOverwrite(false);
editor.keyBinding.$data.buffer = "";
editor.keyBinding.$data.state = "insertMode";
_self.onVisualMode = false;
_self.onVisualLineMode = false;
if(_self.onInsertReplaySequence) {
// Ok, we're apparently replaying ("."), so let's do it
editor.commands.macro = _self.onInsertReplaySequence;
editor.commands.replay(editor);
_self.onInsertReplaySequence = null;
_self.normalMode(editor);
} else {
// Record any movements, insertions in insert mode
if(!editor.commands.recording)
editor.commands.toggleRecording();
}
});
editor.setOverwrite(false);
editor.keyBinding.$data.buffer = "";
editor.keyBinding.$data.state = "insertMode";
_self.onVisualMode = false;
_self.onVisualLineMode = false;
if(_self.onInsertReplaySequence) {
// Ok, we're apparently replaying ("."), so let's do it
editor.commands.macro = _self.onInsertReplaySequence;
editor.commands.replay(editor);
_self.onInsertReplaySequence = null;
_self.normalMode(editor);
} else {
// Record any movements, insertions in insert mode
if(!editor.commands.recording)
editor.commands.toggleRecording();
}
},
normalMode: function(editor) {
// Switch editor to normal mode
Expand Down Expand Up @@ -119,4 +108,4 @@ module.exports = {
editor.moveCursorTo(pos.row, pos.column);
}
};
});
});

0 comments on commit 0736c06

Please sign in to comment.