Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into pflynn/better-quick…
Browse files Browse the repository at this point in the history
…search-field
  • Loading branch information
peterflynn committed Apr 1, 2014
2 parents 210a282 + a209bb7 commit 72aa412
Show file tree
Hide file tree
Showing 74 changed files with 1,538 additions and 334 deletions.
7 changes: 5 additions & 2 deletions src/base-config/keyboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@
"edit.splitSelIntoLines": [
"Ctrl-Alt-L"
],
"edit.addPrevLineToSel": [
"edit.addCursorToPrevLine": [
{
"key": "Shift-Alt-Up",
"displayKey": "Shift-Alt-↑"
}
],
"edit.addNextLineToSel": [
"edit.addCursorToNextLine": [
{
"key": "Shift-Alt-Down",
"displayKey": "Shift-Alt-↓"
Expand Down Expand Up @@ -317,5 +317,8 @@
],
"file.rename": [
"F2"
],
"help.support": [
"F1"
]
}
4 changes: 2 additions & 2 deletions src/brackets.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"about_icon" : "styles/images/brackets_icon.svg",
"update_info_url" : "http://dev.brackets.io/updates/stable/",
"how_to_use_url" : "https://github.com/adobe/brackets/wiki/How-to-Use-Brackets",
"support_url" : "http://help.brackets.io",
"get_involved_url" : "https://github.com/adobe/brackets",
"glob_help_url" : "https://github.com/adobe/brackets/wiki/Using-File-Filters",
"forum_url" : "https://groups.google.com/forum/?fromgroups#!forum/brackets-dev",
"release_notes_url" : "https://github.com/adobe/brackets/wiki/Release-Notes",
"report_issue_url" : "https://github.com/adobe/brackets/wiki/How-to-Report-an-Issue",
"twitter_url" : "https://twitter.com/brackets",
"troubleshoot_url" : "https://github.com/adobe/brackets/wiki/Troubleshooting#wiki-livedev",
"twitter_name" : "@brackets",
Expand Down
16 changes: 8 additions & 8 deletions src/command/Commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ define(function (require, exports, module) {

exports.EDIT_SELECT_LINE = "edit.selectLine"; // EditorCommandHandlers.js selectLine()
exports.EDIT_SPLIT_SEL_INTO_LINES = "edit.splitSelIntoLines"; // EditorCommandHandlers.js splitSelIntoLines()
exports.EDIT_ADD_NEXT_LINE_TO_SEL = "edit.addNextLineToSel"; // EditorCommandHandlers.js addNextLineToSel()
exports.EDIT_ADD_PREV_LINE_TO_SEL = "edit.addPrevLineToSel"; // EditorCommandHandlers.js addPrevLineToSel()
exports.EDIT_ADD_CUR_TO_NEXT_LINE = "edit.addCursorToNextLine"; // EditorCommandHandlers.js addCursorToNextLine()
exports.EDIT_ADD_CUR_TO_PREV_LINE = "edit.addCursorToPrevLine"; // EditorCommandHandlers.js addCursorToPrevLine()
exports.EDIT_FIND = "edit.find"; // FindReplace.js _launchFind()
exports.EDIT_FIND_IN_FILES = "edit.findInFiles"; // FindInFiles.js _doFindInFiles()
exports.EDIT_FIND_IN_SUBTREE = "edit.findInSubtree"; // FindInFiles.js _doFindInSubtree()
Expand All @@ -91,7 +91,7 @@ define(function (require, exports, module) {
exports.EDIT_LINE_DOWN = "edit.lineDown"; // EditorCommandHandlers.js moveLineDown()
exports.EDIT_OPEN_LINE_ABOVE = "edit.openLineAbove"; // EditorCommandHandlers.js openLineAbove()
exports.EDIT_OPEN_LINE_BELOW = "edit.openLineBelow"; // EditorCommandHandlers.js openLineBelow()
exports.TOGGLE_CLOSE_BRACKETS = "edit.autoCloseBrackets"; // EditorOptionHandlers.js _toggleCloseBrackets()
exports.TOGGLE_CLOSE_BRACKETS = "edit.autoCloseBrackets"; // EditorOptionHandlers.js _getToggler()
exports.SHOW_CODE_HINTS = "edit.showCodeHints"; // CodeHintManager.js _startNewSession()

// VIEW
Expand All @@ -102,9 +102,9 @@ define(function (require, exports, module) {
exports.VIEW_SCROLL_LINE_UP = "view.scrollLineUp"; // ViewCommandHandlers.js _handleScrollLineUp()
exports.VIEW_SCROLL_LINE_DOWN = "view.scrollLineDown"; // ViewCommandHandlers.js _handleScrollLineDown()
exports.VIEW_TOGGLE_INSPECTION = "view.toggleCodeInspection"; // CodeInspection.js toggleEnabled()
exports.TOGGLE_LINE_NUMBERS = "view.toggleLineNumbers"; // EditorOptionHandlers.js _toggleLineNumbers()
exports.TOGGLE_ACTIVE_LINE = "view.toggleActiveLine"; // EditorOptionHandlers.js _toggleActiveLine()
exports.TOGGLE_WORD_WRAP = "view.toggleWordWrap"; // EditorOptionHandlers.js _toggleWordWrap()
exports.TOGGLE_LINE_NUMBERS = "view.toggleLineNumbers"; // EditorOptionHandlers.js _getToggler()
exports.TOGGLE_ACTIVE_LINE = "view.toggleActiveLine"; // EditorOptionHandlers.js _getToggler()
exports.TOGGLE_WORD_WRAP = "view.toggleWordWrap"; // EditorOptionHandlers.js _getToggler()
exports.SORT_WORKINGSET_BY_ADDED = "view.sortWorkingSetByAdded"; // WorkingSetSort.js _handleSortWorkingSetByAdded()
exports.SORT_WORKINGSET_BY_NAME = "view.sortWorkingSetByName"; // WorkingSetSort.js _handleSortWorkingSetByName()
exports.SORT_WORKINGSET_BY_TYPE = "view.sortWorkingSetByType"; // WorkingSetSort.js _handleSortWorkingSetByType()
Expand All @@ -129,9 +129,9 @@ define(function (require, exports, module) {
// HELP
exports.HELP_CHECK_FOR_UPDATE = "help.checkForUpdate"; // HelpCommandHandlers.js _handleCheckForUpdates()
exports.HELP_HOW_TO_USE_BRACKETS = "help.howToUseBrackets"; // HelpCommandHandlers.js _handleLinkMenuItem()
exports.HELP_FORUM = "help.forum"; // HelpCommandHandlers.js _handleLinkMenuItem()
exports.HELP_SUPPORT = "help.support"; // HelpCommandHandlers.js _handleLinkMenuItem()
exports.HELP_RELEASE_NOTES = "help.releaseNotes"; // HelpCommandHandlers.js _handleLinkMenuItem()
exports.HELP_REPORT_AN_ISSUE = "help.reportAnIssue"; // HelpCommandHandlers.js _handleLinkMenuItem()
exports.HELP_GET_INVOLVED = "help.getInvolved"; // HelpCommandHandlers.js _handleLinkMenuItem()
exports.HELP_SHOW_EXT_FOLDER = "help.showExtensionsFolder"; // HelpCommandHandlers.js _handleShowExtensionsFolder()
exports.HELP_TWITTER = "help.twitter"; // HelpCommandHandlers.js _handleLinkMenuItem()

Expand Down
12 changes: 6 additions & 6 deletions src/command/DefaultMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ define(function (require, exports, module) {
menu.addMenuItem(Commands.EDIT_SELECT_ALL);
menu.addMenuItem(Commands.EDIT_SELECT_LINE);
menu.addMenuItem(Commands.EDIT_SPLIT_SEL_INTO_LINES);
menu.addMenuItem(Commands.EDIT_ADD_PREV_LINE_TO_SEL);
menu.addMenuItem(Commands.EDIT_ADD_NEXT_LINE_TO_SEL);
menu.addMenuItem(Commands.EDIT_ADD_CUR_TO_PREV_LINE);
menu.addMenuItem(Commands.EDIT_ADD_CUR_TO_NEXT_LINE);
menu.addMenuDivider();
menu.addMenuItem(Commands.EDIT_FIND);
menu.addMenuItem(Commands.EDIT_FIND_IN_FILES);
Expand Down Expand Up @@ -157,14 +157,14 @@ define(function (require, exports, module) {
if (brackets.config.how_to_use_url) {
menu.addMenuItem(Commands.HELP_HOW_TO_USE_BRACKETS);
}
if (brackets.config.forum_url) {
menu.addMenuItem(Commands.HELP_FORUM);
if (brackets.config.support_url) {
menu.addMenuItem(Commands.HELP_SUPPORT);
}
if (brackets.config.release_notes_url) {
menu.addMenuItem(Commands.HELP_RELEASE_NOTES);
}
if (brackets.config.report_issue_url) {
menu.addMenuItem(Commands.HELP_REPORT_AN_ISSUE);
if (brackets.config.get_involved_url) {
menu.addMenuItem(Commands.HELP_GET_INVOLVED);
}

menu.addMenuDivider();
Expand Down
4 changes: 2 additions & 2 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"about_icon": "styles/images/brackets_icon.svg",
"update_info_url": "http://dev.brackets.io/updates/stable/",
"how_to_use_url": "https://github.com/adobe/brackets/wiki/How-to-Use-Brackets",
"support_url": "http://help.brackets.io",
"get_involved_url": "https://github.com/adobe/brackets",
"glob_help_url": "https://github.com/adobe/brackets/wiki/Using-File-Filters",
"forum_url": "https://groups.google.com/forum/?fromgroups#!forum/brackets-dev",
"release_notes_url": "https://github.com/adobe/brackets/wiki/Release-Notes",
"report_issue_url": "https://github.com/adobe/brackets/wiki/How-to-Report-an-Issue",
"twitter_url": "https://twitter.com/brackets",
"troubleshoot_url": "https://github.com/adobe/brackets/wiki/Troubleshooting#wiki-livedev",
"twitter_name": "@brackets",
Expand Down
6 changes: 6 additions & 0 deletions src/document/Document.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ define(function (require, exports, module) {
*/
Document.prototype.isDirty = false;

/**
* Whether this document is currently being saved.
* @type {boolean}
*/
Document.prototype.isSaving = false;

/**
* What we expect the file's timestamp to be on disk. If the timestamp differs from this, then
* it means the file was modified by an app other than Brackets.
Expand Down
55 changes: 33 additions & 22 deletions src/document/DocumentCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,31 +750,39 @@ define(function (require, exports, module) {
return;
}

doc.isSaving = true; // mark that we're saving the document

// First, write document's current text to new file
newFile = FileSystem.getFileForPath(path);

// Save as warns you when you're about to overwrite a file, so we
// explictly allow "blind" writes to the filesystem in this case,
// ignoring warnings about the contents being modified outside of
// the editor.
FileUtils.writeText(newFile, doc.getText(), true).done(function () {
// If there were unsaved changes before Save As, they don't stay with the old
// file anymore - so must revert the old doc to match disk content.
// Only do this if the doc was dirty: doRevert on a file that is not dirty and
// not in the working set has the side effect of adding it to the working set.
if (doc.isDirty && !(doc.isUntitled())) {
// if the file is dirty it must be in the working set
// doRevert is side effect free in this case
doRevert(doc).always(openNewFile);
} else {
openNewFile();
}
}).fail(function (error) {
_showSaveFileError(error, path)
.done(function () {
result.reject(error);
});
});
FileUtils.writeText(newFile, doc.getText(), true)
.done(function () {
// If there were unsaved changes before Save As, they don't stay with the old
// file anymore - so must revert the old doc to match disk content.
// Only do this if the doc was dirty: doRevert on a file that is not dirty and
// not in the working set has the side effect of adding it to the working set.
if (doc.isDirty && !(doc.isUntitled())) {
// if the file is dirty it must be in the working set
// doRevert is side effect free in this case
doRevert(doc).always(openNewFile);
} else {
openNewFile();
}
})
.fail(function (error) {
_showSaveFileError(error, path)
.done(function () {
result.reject(error);
});
})
.always(function () {
// mark that we're done saving the document
doc.isSaving = false;
});
}

if (doc) {
Expand Down Expand Up @@ -823,7 +831,7 @@ define(function (require, exports, module) {
doc = (commandData && commandData.doc) || activeDoc,
settings;

if (doc) {
if (doc && !doc.isSaving) {
if (doc.isUntitled()) {
if (doc === activeDoc) {
settings = {
Expand Down Expand Up @@ -1466,6 +1474,12 @@ define(function (require, exports, module) {
Menus.removeMenu(key);
});

// If there's a fragment in both URLs, setting location.href won't actually reload
var fragment = href.indexOf("#");
if (fragment !== -1) {
href = href.substr(0, fragment);
}

window.location.href = href;
});
}).fail(function () {
Expand Down Expand Up @@ -1560,9 +1574,6 @@ define(function (require, exports, module) {
// Register global commands
CommandManager.register(Strings.CMD_FILE_OPEN, Commands.FILE_OPEN, handleFileOpen);
CommandManager.register(Strings.CMD_ADD_TO_WORKING_SET, Commands.FILE_ADD_TO_WORKING_SET, handleFileAddToWorkingSet);
// TODO: (issue #274) For now, hook up File > New to the "new in project" handler. Eventually
// File > New should open a new blank tab, and handleFileNewInProject should
// be called from a "+" button in the project
CommandManager.register(Strings.CMD_FILE_NEW_UNTITLED, Commands.FILE_NEW_UNTITLED, handleFileNew);
CommandManager.register(Strings.CMD_FILE_NEW, Commands.FILE_NEW, handleFileNewInProject);
CommandManager.register(Strings.CMD_FILE_NEW_FOLDER, Commands.FILE_NEW_FOLDER, handleNewFolderInProject);
Expand Down
2 changes: 1 addition & 1 deletion src/editor/CSSInlineEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ define(function (require, exports, module) {
*/
function _addRule(selectorName, inlineEditor, path) {
DocumentManager.getDocumentForPath(path).done(function (styleDoc) {
var newRuleInfo = CSSUtils.addRuleToDocument(styleDoc, selectorName, Editor.getUseTabChar(), Editor.getSpaceUnits());
var newRuleInfo = CSSUtils.addRuleToDocument(styleDoc, selectorName, Editor.getUseTabChar(path), Editor.getSpaceUnits(path));
inlineEditor.addAndSelectRange(selectorName, styleDoc, newRuleInfo.range.from.line, newRuleInfo.range.to.line);
inlineEditor.editor.setCursorPos(newRuleInfo.pos.line, newRuleInfo.pos.ch);
});
Expand Down
Loading

0 comments on commit 72aa412

Please sign in to comment.