small cleanup

This commit is contained in:
nightwing 2013-03-18 17:01:10 +04:00
commit 3a781ed2c2
3 changed files with 29 additions and 43 deletions

View file

@ -209,14 +209,6 @@
box-sizing: border-box;
}
.ace_marker-layer .ace_isearch-result {
position: absolute;
z-index: 6;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}}
.ace_line .ace_fold {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;

View file

@ -209,20 +209,23 @@ exports.IncrementalSearch = IncrementalSearch;
**/
var dom = require('./lib/dom');
function patchHighlightMarkerStyling(options) {
options = options || {};
var id = 'incremental-search-highlighting',
css = 'div.ace_isearch-result {\n'
+ " border-radius: 4px;\n"
+ " border: 8px solid rgba(255, 200, 0, 0.5);\n"
+ " box-shadow: 0 0 4px rgb(255, 200, 0);\n"
+ "}\n"
+ '.ace_dark div.ace_isearch-result {\n'
+ " border: 8px solid rgb(100, 110, 160);\n"
+ " box-shadow: 0 0 4px rgb(80, 90, 140);\n"
+ '}\n'
dom.importCssString(css, id);
}
dom.importCssString && dom.importCssString("\
.ace_marker-layer .ace_isearch-result {\
position: absolute;\
z-index: 6;\
-moz-box-sizing: border-box;\
-webkit-box-sizing: border-box;\
box-sizing: border-box;\
}\
div.ace_isearch-result {\
border-radius: 4px;\
border: 8px solid rgba(255, 200, 0, 0.5);\
box-shadow: 0 0 4px rgb(255, 200, 0);\
}\
.ace_dark div.ace_isearch-result {\
border: 8px solid rgb(100, 110, 160);\
box-shadow: 0 0 4px rgb(80, 90, 140);\
}", "incremental-search-highlighting");
// support for default keyboard handler
var commands = require("./commands/command_manager");
@ -230,8 +233,8 @@ var commands = require("./commands/command_manager");
this.setupIncrementalSearch = function(editor, val) {
if (this.usesIncrementalSearch == val) return;
this.usesIncrementalSearch = val;
var iSearchCommands = iSearchCommandModule.iSearchStartCommands,
method = val ? 'addCommands' : 'removeCommands';
var iSearchCommands = iSearchCommandModule.iSearchStartCommands;
var method = val ? 'addCommands' : 'removeCommands';
this[method](iSearchCommands);
};
}).call(commands.CommandManager.prototype);
@ -241,7 +244,6 @@ var Editor = require("./editor").Editor;
require("./config").defineOptions(Editor.prototype, "editor", {
useIncrementalSearch: {
set: function(val) {
patchHighlightMarkerStyling({enable: val});
this.keyBinding.$handlers.forEach(function(handler) {
if (handler.setupIncrementalSearch) {
handler.setupIncrementalSearch(this, val);

View file

@ -32,6 +32,9 @@ define(function(require, exports, module) {
"use strict";
var dom = require("../lib/dom");
require("../incremental_search");
var iSearchCommandModule = require("../commands/incremental_search_commands");
var screenToTextBlockCoordinates = function(x, y) {
var canvasPos = this.scroller.getBoundingClientRect();
@ -102,14 +105,12 @@ exports.handler.attach = function(editor) {
}
editor.on("click", $resetMarkMode);
editor.on("changeSession",$kbSessionChange);
editor.on("changeSession", $kbSessionChange);
editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates;
editor.setStyle("emacs-mode");
editor.commands.addCommands(commands);
exports.handler.platform = editor.commands.platform;
editor.$emacsModeHandler = this;
if (!editor.getOption('useIncrementalSearch')) editor.setOption('useIncrementalSearch', true)
else this.setupIncrementalSearch(editor, true);;
};
exports.handler.detach = function(editor) {
@ -300,8 +301,10 @@ exports.emacsKeys = {
"PageUp|M-v": {command: "goorselect", args: ["gotopageup","selectpageup"]},
"S-C-Down": "selectpagedown",
"S-C-Up": "selectpageup",
"C-s": "findnext",
"C-r": "findprevious",
"C-s": "iSearch",
"C-r": "iSearchBackwards",
"M-C-s": "findnext",
"M-C-r": "findprevious",
"S-M-5": "replace",
@ -461,6 +464,8 @@ exports.handler.addCommands({
}
});
exports.handler.addCommands(iSearchCommandModule.iSearchStartCommands);
var commands = exports.handler.commands;
commands.yank.isYank = true;
commands.yankRotate.isYank = true;
@ -486,17 +491,4 @@ exports.killRing = {
}
};
require('../incremental_search');
exports.handler.setupIncrementalSearch = function(editor, val) {
if (this.usesIncrementalSearch == val) return;
this.usesIncrementalSearch = val;
if (val) {
this.bindKey('C-s', 'iSearch');
this.bindKey('C-r', 'iSearchBackwards');
} else {
this.bindKey('C-s', "findnext");
this.bindKey('C-r', "findprevious");
}
}
});