Added the ability to turn off worker-based hinting.

This commit is contained in:
Thomas Wilburn 2013-09-13 08:01:52 -07:00
parent 2e87c78cde
commit c8cf1fd610
2 changed files with 16 additions and 9 deletions

View file

@ -5,7 +5,7 @@ these files from the menu, then save it, it'll be dropped into Chrome's
synchronized storage, which means that (theoretically) all your computers will synchronized storage, which means that (theoretically) all your computers will
get a copy. get a copy.
Unfortunately, it's not (yet) feasible to merge configuration the way that Unfortunately, it's not (yet) possible to merge configuration the way that
Sublime does, which means that this won't behave exactly like you may expect. Sublime does, which means that this won't behave exactly like you may expect.
If new options are introduced, you'll need to copy your settings to a new If new options are introduced, you'll need to copy your settings to a new
file, reset Caret's config to the defaults from the menu, then copy your file, reset Caret's config to the defaults from the menu, then copy your
@ -17,5 +17,6 @@ configuration changes back over. Sorry about that. I'm working on it.
"indentation": 2, "indentation": 2,
"wordWrap": true, "wordWrap": true,
"fontFamily": "", //WARNING: only fixed-width fonts are currently supported "fontFamily": "", //WARNING: only fixed-width fonts are currently supported
"fontSize": 13 "fontSize": 13,
"useWorker": true
} }

View file

@ -28,7 +28,7 @@ define([
session.retain(); session.retain();
session.setUnmodified(); session.setUnmodified();
return; return;
}; }
session.isTab = true; session.isTab = true;
session.setUndoManager(new ace.UndoManager()); session.setUndoManager(new ace.UndoManager());
@ -89,6 +89,7 @@ define([
var id = this.file.retain(); var id = this.file.retain();
if (!id) return; if (!id) return;
chrome.storage.local.get("retained", function(data) { chrome.storage.local.get("retained", function(data) {
if (!data.retained) return;
var filtered = data.retained.filter(function(item) { return item != id }); var filtered = data.retained.filter(function(item) { return item != id });
chrome.storage.local.set({ retained: filtered }); chrome.storage.local.set({ retained: filtered });
}); });
@ -132,6 +133,7 @@ define([
var setTabSyntax = function(tab) { var setTabSyntax = function(tab) {
tab.setTabSize(userConfig.indentation || 2); tab.setTabSize(userConfig.indentation || 2);
tab.setUseWrapMode(userConfig.wordWrap); tab.setUseWrapMode(userConfig.wordWrap);
tab.setUseWorker(userConfig.useWorker);
var syntaxValue = "plain_text"; var syntaxValue = "plain_text";
if (tab.file) { if (tab.file) {
var found = false; var found = false;
@ -189,7 +191,7 @@ define([
next = 0; next = 0;
} }
raiseTab(next); raiseTab(next);
} };
if (tab.modified) { if (tab.modified) {
dialog( dialog(
@ -200,7 +202,7 @@ define([
tab.save(); tab.save();
} }
continuation(); continuation();
}) });
} else { } else {
continuation(); continuation();
} }
@ -220,7 +222,7 @@ define([
shifted = tabs.length + shifted; shifted = tabs.length + shifted;
} }
raiseTab(shifted); raiseTab(shifted);
} };
var openFile = function() { var openFile = function() {
var f = new File(); var f = new File();
@ -238,10 +240,10 @@ define([
f.entry = file.entry; f.entry = file.entry;
f.read(function(err, contents) { f.read(function(err, contents) {
addTab(contents, f); addTab(contents, f);
}) });
}) });
}
} }
};
var syntax = document.find(".syntax"); var syntax = document.find(".syntax");
@ -276,6 +278,7 @@ define([
//after a reasonable delay, filter failures out of retention //after a reasonable delay, filter failures out of retention
setTimeout(function() { setTimeout(function() {
chrome.storage.local.get("retained", function(data) { chrome.storage.local.get("retained", function(data) {
if (!data.retained) return;
chrome.storage.local.set({ chrome.storage.local.set({
retained: data.retained.filter(function(d) { return failures.indexOf(d) == -1 }) retained: data.retained.filter(function(d) { return failures.indexOf(d) == -1 })
}); });
@ -287,6 +290,9 @@ define([
var reset = function() { var reset = function() {
cfg = Settings.get("ace"); cfg = Settings.get("ace");
userConfig = Settings.get("user"); userConfig = Settings.get("user");
tabs.forEach(function(tab) {
setTabSyntax(tab);
})
}; };
command.on("init:startup", init); command.on("init:startup", init);