Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/adobe/brackets into quote…
Browse files Browse the repository at this point in the history
…-fix

Conflicts:
	src/nls/fi/strings.js

Fix also new CSS_QUICK_EDIT_NO_MATCHES key added in adobe#5798.
  • Loading branch information
jukkah committed Nov 6, 2013
2 parents a9712b8 + 0ab2b09 commit 5b03280
Show file tree
Hide file tree
Showing 42 changed files with 1,169 additions and 255 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Brackets",
"version": "0.33.0-0",
"apiVersion": "0.33.0",
"version": "0.34.0-0",
"apiVersion": "0.34.0",
"homepage": "http://brackets.io",
"issues": {
"url": "http://github.com/adobe/brackets/issues"
Expand Down
31 changes: 26 additions & 5 deletions src/LiveDevelopment/LiveDevelopment.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ define(function LiveDevelopment(require, exports, module) {
// After (1) the interstitial page loads, (2) then browser navigation
// to the base URL is completed, and (3) the agents finish loading
// gather related documents and finally set status to STATUS_ACTIVE.
var doc = _getCurrentDocument(); // TODO: probably wrong...
var doc = _liveDocument.doc;

if (doc) {
var status = STATUS_ACTIVE,
Expand Down Expand Up @@ -799,8 +799,19 @@ define(function LiveDevelopment(require, exports, module) {
* the status accordingly.
*/
function cleanup() {
_setStatus(STATUS_INACTIVE, reason || "explicit_close");
deferred.resolve();
// Need to do this in order to trigger the corresponding CloseLiveBrowser cleanups required on
// the native Mac side
var closeDeferred = (brackets.platform === "mac") ? NativeApp.closeLiveBrowser() : $.Deferred().resolve();
closeDeferred.done(function () {
_setStatus(STATUS_INACTIVE, reason || "explicit_close");
deferred.resolve();
}).fail(function (err) {
if (err) {
reason += " (" + err + ")";
}
_setStatus(STATUS_INACTIVE, reason || "explicit_close");
deferred.resolve();
});
}

if (_openDeferred) {
Expand Down Expand Up @@ -1034,7 +1045,7 @@ define(function LiveDevelopment(require, exports, module) {
if (id === Dialogs.DIALOG_BTN_OK) {
// User has chosen to reload Chrome, quit the running instance
_setStatus(STATUS_INACTIVE);
NativeApp.closeLiveBrowser()
_close()
.done(function () {
browserStarted = false;
window.setTimeout(function () {
Expand All @@ -1049,7 +1060,17 @@ define(function LiveDevelopment(require, exports, module) {
_openDeferred.reject("CLOSE_LIVE_BROWSER");
});
} else {
_openDeferred.reject("CANCEL");
_close()
.done(function () {
browserStarted = false;
_openDeferred.reject("CANCEL");
})
.fail(function (err) {
// Report error?
_setStatus(STATUS_ERROR);
browserStarted = false;
_openDeferred.reject("CLOSE_LIVE_BROWSER");
});
}
});

Expand Down
4 changes: 2 additions & 2 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"linting.enabled_by_default": true
},
"name": "Brackets",
"version": "0.33.0-0",
"apiVersion": "0.33.0",
"version": "0.34.0-0",
"apiVersion": "0.34.0",
"homepage": "http://brackets.io",
"issues": {
"url": "http://github.com/adobe/brackets/issues"
Expand Down
2 changes: 1 addition & 1 deletion src/document/DocumentCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ define(function (require, exports, module) {
if (doc) {
DocumentManager.addToWorkingSet(doc.file);
}
_defaultOpenDialogFullPath = FileUtils.getDirectoryPath(EditorManager.getCurrentlyViewedPath);
_defaultOpenDialogFullPath = FileUtils.getDirectoryPath(EditorManager.getCurrentlyViewedPath());
})
// Send the resulting document that was opened
.then(result.resolve, result.reject);
Expand Down
29 changes: 13 additions & 16 deletions src/editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,18 @@ define(function (require, exports, module) {
if (indentAuto) {
var currentLength = line.length;
CodeMirror.commands.indentAuto(instance);
// If the amount of whitespace didn't change, insert another tab

// If the amount of whitespace and the cursor position didn't change, we must have
// already been at the correct indentation level as far as CM is concerned, so insert
// another tab.
if (instance.getLine(from.line).length === currentLength) {
insertTab = true;
to.ch = 0;
var newFrom = instance.getCursor(true),
newTo = instance.getCursor(false);
if (newFrom.line === from.line && newFrom.ch === from.ch &&
newTo.line === to.line && newTo.ch === to.ch) {
insertTab = true;
to.ch = 0;
}
}
} else if (instance.somethingSelected() && from.line !== to.line) {
CodeMirror.commands.indentMore(instance);
Expand Down Expand Up @@ -978,21 +986,10 @@ define(function (require, exports, module) {
return;
}

// Handle hiding a single blank line at the end specially by moving the "from" backwards
// to include the last newline. Otherwise CodeMirror doesn't hide anything in this case.
var hideFrom, inclusiveLeft = true;
if (from === to - 1 && from === this._codeMirror.lineCount() - 1 && this._codeMirror.getLine(from).length === 0) {
hideFrom = {line: from - 1, ch: this._codeMirror.getLine(from - 1).length};
// Allow the cursor to be set immediately before the hidden newline.
inclusiveLeft = false;
} else {
hideFrom = {line: from, ch: 0};
}

var value = this._codeMirror.markText(
hideFrom,
{line: from, ch: 0},
{line: to - 1, ch: this._codeMirror.getLine(to - 1).length},
{collapsed: true, inclusiveLeft: inclusiveLeft, inclusiveRight: true}
{collapsed: true, inclusiveLeft: true, inclusiveRight: true}
);

return value;
Expand Down
4 changes: 2 additions & 2 deletions src/editor/ImageViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ define(function (require, exports, module) {
$("#img-preview").on("load", function () {
// add dimensions and size
_naturalWidth = this.naturalWidth;
var dimensionString = _naturalWidth + " x " + this.naturalHeight + " " + Strings.UNIT_PIXELS;
var dimensionString = _naturalWidth + " × " + this.naturalHeight + " " + Strings.UNIT_PIXELS;
// get image size
var fileEntry = new NativeFileSystem.FileEntry(fullPath);
fileEntry.getMetadata(
Expand All @@ -110,7 +110,7 @@ define(function (require, exports, module) {
$("#img-data").html(dimensionString + sizeString);
},
function (error) {
$("#img-data").text(dimensionString);
$("#img-data").html(dimensionString);
}
);
$("#image-holder").show();
Expand Down
29 changes: 27 additions & 2 deletions src/extensibility/ExtensionManagerDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,15 @@ define(function (require, exports, module) {
$search,
$searchClear,
context = { Strings: Strings, showRegistry: !!brackets.config.extension_registry },
models = [new ExtensionManagerViewModel.InstalledViewModel()];
models = [];

// Load registry only if the registry URL exists
if (context.showRegistry) {
models.push(new ExtensionManagerViewModel.RegistryViewModel());
}

models.push(new ExtensionManagerViewModel.InstalledViewModel());

function updateSearchDisabled() {
var model = models[_activeTabIndex],
searchDisabled = ($search.val() === "") &&
Expand Down Expand Up @@ -189,13 +191,36 @@ define(function (require, exports, module) {
$(this).tab("show");
});

// Update & hide/show the notification overlay on a tab's icon, based on its model's notifyCount
function updateNotificationIcon(index) {
var model = models[index],
$notificationIcon = $dlg.find(".nav-tabs li").eq(index).find(".notification");
if (model.notifyCount) {
$notificationIcon.text(model.notifyCount);
$notificationIcon.show();
} else {
$notificationIcon.hide();
}
}

// Initialize models and create a view for each model
var modelInitPromise = Async.doInParallel(models, function (model, index) {
var view = new ExtensionManagerView(),
promise = view.initialize(model);
promise = view.initialize(model),
lastNotifyCount;

promise.always(function () {
views[index] = view;

lastNotifyCount = model.notifyCount;
updateNotificationIcon(index);
});

$(model).on("change", function () {
if (lastNotifyCount !== model.notifyCount) {
lastNotifyCount = model.notifyCount;
updateNotificationIcon(index);
}
});

return promise;
Expand Down
29 changes: 29 additions & 0 deletions src/extensibility/ExtensionManagerViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ define(function (require, exports, module) {
*/
ExtensionManagerViewModel.prototype.message = null;

/**
* @type {number}
* Number to show in tab's notification icon. No icon shown if 0.
*/
ExtensionManagerViewModel.prototype.notifyCount = 0;

/**
* @private {$.Promise}
* Internal use only to track when initialization fails, see usage in _updateMessage.
Expand Down Expand Up @@ -374,6 +380,8 @@ define(function (require, exports, module) {
});
this._sortFullSet();
this._setInitialFilter();
this._countUpdates();

return new $.Deferred().resolve().promise();
};

Expand All @@ -399,6 +407,20 @@ define(function (require, exports, module) {
});
};

/**
* @private
* Updates notifyCount based on number of extensions with an update available
*/
InstalledViewModel.prototype._countUpdates = function () {
var self = this;
this.notifyCount = 0;
this.sortedFullSet.forEach(function (key) {
if (self.extensions[key].installInfo.updateAvailable) {
self.notifyCount++;
}
});
};

/**
* @private
* Updates the initial set and filter as necessary when the status of an extension changes,
Expand All @@ -412,6 +434,7 @@ define(function (require, exports, module) {
if (index !== -1 && !this.extensions[id].installInfo) {
// This was in our set, but was uninstalled. Remove it.
this.sortedFullSet.splice(index, 1);
this._countUpdates(); // may also affect update count
refilter = true;
} else if (index === -1 && this.extensions[id].installInfo) {
// This was not in our set, but is now installed. Add it and resort.
Expand All @@ -422,6 +445,12 @@ define(function (require, exports, module) {
if (refilter) {
this.filter(this._lastQuery || "", true);
}

if (this.extensions[id].installInfo) {
// If our count of available updates may have been affected, re-count
this._countUpdates();
}

ExtensionManagerViewModel.prototype._handleStatusChange.call(this, e, id);
};

Expand Down
4 changes: 2 additions & 2 deletions src/extensions/default/CSSCodeHints/CSSProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"counter-reset": {"values": ["none", "inherit"]},
"cursor": {"values": ["auto", "crosshair", "e-resize", "default", "help", "move", "n-resize", "ne-resize", "nw-resize", "pointer", "progress", "s-resize", "se-resize", "sw-resize", "text", "w-resize", "wait", "inherit"]},
"direction": {"values": ["ltr", "rtl", "inherit"]},
"display": {"values": ["block", "flex", "inline", "inline-block", "inline-flex", "inline-table", "list-item", "none", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row", "table-row-group", "inherit"]},
"display": {"values": ["block", "flex", "grid", "inline", "inline-block", "inline-flex", "inline-grid", "inline-table", "list-item", "none", "run-in", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row", "table-row-group", "inherit"]},
"empty-cells": {"values": ["hide", "show", "inherit"]},
"flex": {"values": ["none"]},
"flex-basis": {"values": []},
Expand Down Expand Up @@ -182,7 +182,7 @@
"text-transform": {"values": ["capitalize", "full-width", "lowercase", "none", "uppercase", "inherit"]},
"text-underline-position": {"values": ["alphabetic", "auto", "below", "left", "right"]},
"top": {"values": ["auto", "inherit"]},
"transform": {"values": ["matrix()", "matrix3d()", "perspective()", "rotate()", "rotate3d()", "rotateX()", "rotateY()", "rotateZ()", "scale()", "scale3d()", "scaleX()", "scaleY()", "scaleZ()", "skewX()", "skewY()", "translate()", "translate3d()", "translateX()", "translateY()", "translateZ()"]},
"transform": {"values": ["matrix()", "matrix3d()", "none", "perspective()", "rotate()", "rotate3d()", "rotateX()", "rotateY()", "rotateZ()", "scale()", "scale3d()", "scaleX()", "scaleY()", "scaleZ()", "skewX()", "skewY()", "translate()", "translate3d()", "translateX()", "translateY()", "translateZ()"]},
"transform-origin": {"values": ["bottom", "center", "left", "right", "top"]},
"transform-style": {"values": ["flat", "preserve-3d"]},
"transition": {"values": []},
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/default/JavaScriptCodeHints/ScopeManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ define(function (require, exports, module) {

var MAX_HINTS = 30, // how often to reset the tern server
LARGE_LINE_CHANGE = 100,
LARGE_LINE_COUNT = 250,
LARGE_LINE_COUNT = 2000,
OFFSET_ZERO = {line: 0, ch: 0};

/**
Expand Down
6 changes: 3 additions & 3 deletions src/extensions/default/JavaScriptCodeHints/unittests.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ define(function (require, exports, module) {
});
});

it("should list function defined from .prototype", function () {
xit("should list function defined from .prototype", function () {
var start = { line: 59, ch: 5 };

testEditor.setCursorPos(start);
Expand All @@ -905,15 +905,15 @@ define(function (require, exports, module) {

});

it("should list function type defined from .prototype", function () {
xit("should list function type defined from .prototype", function () {
var start = { line: 59, ch: 10 };
testEditor.setCursorPos(start);
runs(function () {
expectParameterHint([{name: "a4", type: "Number"}, {name: "b4", type: "Number"}], 0);
});
});

it("should list function inhertated from super class", function () {
xit("should list function inherited from super class", function () {
var start = { line: 79, ch: 11 };
testEditor.setCursorPos(start);
var hintObj = expectHints(JSCodeHints.jsHintProvider);
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/default/QuickView/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ define(function (require, exports, module) {
$previewContainer.find(".image-preview > img").on("load", function () {
$previewContent
.append("<div class='img-size'>" +
this.naturalWidth + " x " + this.naturalHeight + " " + Strings.UNIT_PIXELS +
this.naturalWidth + " &times; " + this.naturalHeight + " " + Strings.UNIT_PIXELS +
"</div>"
);
$previewContainer.show();
Expand Down
22 changes: 17 additions & 5 deletions src/extensions/default/UrlCodeHints/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@ define(function (require, exports, module) {
// convert to doc relative path
var entryStr = entry.fullPath.replace(docDir, "");

// code hints show the same strings that are inserted into text,
// so strings in list will be encoded. wysiwyg, baby!
unfiltered.push(encodeURI(entryStr));
// code hints show the unencoded string so the
// choices are easier to read. The encoded string
// will still be inserted into the editor.
unfiltered.push(entryStr);
}
});

Expand Down Expand Up @@ -225,7 +226,7 @@ define(function (require, exports, module) {
};

/**
* Determines whether font hints are available in the current editor
* Determines whether url hints are available in the current editor
* context.
*
* @param {Editor} editor
Expand Down Expand Up @@ -361,7 +362,7 @@ define(function (require, exports, module) {
};

/**
* Returns a list of availble font hints, if possible, for the current
* Returns a list of available url hints, if possible, for the current
* editor context.
*
* @return {jQuery.Deferred|{
Expand Down Expand Up @@ -504,6 +505,10 @@ define(function (require, exports, module) {
*/
UrlCodeHints.prototype.insertHint = function (completion) {
var mode = this.editor.getModeForSelection();

// Encode the string just prior to inserting the hint into the editor
completion = encodeURI(completion);

if (mode === "html") {
return this.insertHtmlHint(completion);
} else if (mode === "css") {
Expand Down Expand Up @@ -754,4 +759,11 @@ define(function (require, exports, module) {
// For unit testing
exports.hintProvider = urlHints;
});

$(ProjectManager).on("projectFilesChange", function (event, projectRoot) {
// Cache may or may not be stale. Main benefit of cache is to limit async lookups
// during typing. File tree updates cannot happen during typing, so it's probably
// not worth determining whether cache may still be valid. Just delete it.
exports.hintProvider.cachedHints = null;
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
float: left;
padding-left: 20px;
width: 35%;
word-break: break-all;
word-wrap: break-word;
-webkit-hyphens: auto;
hyphens: auto;

Expand Down
Loading

0 comments on commit 5b03280

Please sign in to comment.