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

Commit 941fdd2

Browse files
author
Narciso Jaramillo
committed
Merge from master
2 parents 510fd2e + 8971aed commit 941fdd2

6 files changed

Lines changed: 133 additions & 117 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Together with your contributions, we're getting close to our first release candi
3030

3131
#### Download
3232

33-
Installers for the latest stable build for Mac, Windows and Linux (Debian/Ubuntu) can be [downloaded here](http://download.brackets.io/).
33+
Installers for the latest stable build for Mac, Windows and Linux (Debian/Ubuntu) can be [downloaded here](http://brackets.io/).
3434

3535
The Linux version has most of the features of the Mac and Windows versions, but
3636
is still missing a few things. See the [Linux wiki page](https://github.com/adobe/brackets/wiki/Linux-Version)

src/brackets.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ define(function (require, exports, module) {
5151
require("thirdparty/CodeMirror2/addon/edit/matchbrackets");
5252
require("thirdparty/CodeMirror2/addon/edit/closebrackets");
5353
require("thirdparty/CodeMirror2/addon/edit/closetag");
54+
require("thirdparty/CodeMirror2/addon/scroll/scrollpastend");
5455
require("thirdparty/CodeMirror2/addon/selection/active-line");
5556
require("thirdparty/CodeMirror2/addon/mode/multiplex");
5657
require("thirdparty/CodeMirror2/addon/mode/overlay");
@@ -100,6 +101,7 @@ define(function (require, exports, module) {
100101
CodeInspection = require("language/CodeInspection"),
101102
NativeApp = require("utils/NativeApp"),
102103
DeprecationWarning = require("utils/DeprecationWarning"),
104+
ViewCommandHandlers = require("view/ViewCommandHandlers"),
103105
_ = require("thirdparty/lodash");
104106

105107
// DEPRECATED: In future we want to remove the global CodeMirror, but for now we
@@ -120,7 +122,6 @@ define(function (require, exports, module) {
120122
require("editor/EditorStatusBar");
121123
require("editor/EditorCommandHandlers");
122124
require("editor/EditorOptionHandlers");
123-
require("view/ViewCommandHandlers");
124125
require("help/HelpCommandHandlers");
125126
require("search/FindInFiles");
126127
require("search/FindReplace");
@@ -233,6 +234,7 @@ define(function (require, exports, module) {
233234
// Load the initial project after extensions have loaded
234235
extensionLoaderPromise.always(function () {
235236
// Finish UI initialization
237+
ViewCommandHandlers.restoreFontSize();
236238
var initialProjectPath = ProjectManager.getInitialProjectPath();
237239
ProjectManager.openProject(initialProjectPath).always(function () {
238240
_initTest();

src/editor/Editor.js

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ define(function (require, exports, module) {
8686
STYLE_ACTIVE_LINE = "styleActiveLine",
8787
WORD_WRAP = "wordWrap",
8888
CLOSE_TAGS = "closeTags",
89+
SCROLL_PAST_END = "scrollPastEnd",
8990
cmOptions = {};
9091

9192
// Mappings from Brackets preferences to CodeMirror options
@@ -98,6 +99,7 @@ define(function (require, exports, module) {
9899
cmOptions[STYLE_ACTIVE_LINE] = "styleActiveLine";
99100
cmOptions[WORD_WRAP] = "lineWrapping";
100101
cmOptions[CLOSE_TAGS] = "autoCloseTags";
102+
cmOptions[SCROLL_PAST_END] = "scrollPastEnd";
101103

102104
PreferencesManager.definePreference(SMART_INDENT, "boolean", true);
103105
PreferencesManager.definePreference(USE_TAB_CHAR, "boolean", false);
@@ -108,9 +110,9 @@ define(function (require, exports, module) {
108110
PreferencesManager.definePreference(STYLE_ACTIVE_LINE, "boolean", false);
109111
PreferencesManager.definePreference(WORD_WRAP, "boolean", true);
110112
PreferencesManager.definePreference(CLOSE_TAGS, "Object", { whenOpening: true, whenClosing: true, indentTags: [] });
113+
PreferencesManager.definePreference(SCROLL_PAST_END, "boolean", false);
111114

112-
var editorOptions = [SMART_INDENT, USE_TAB_CHAR, TAB_SIZE, SPACE_UNITS, CLOSE_BRACKETS,
113-
SHOW_LINE_NUMBERS, STYLE_ACTIVE_LINE, WORD_WRAP, CLOSE_TAGS];
115+
var editorOptions = Object.keys(cmOptions);
114116

115117
/** Editor preferences */
116118

@@ -231,22 +233,23 @@ define(function (require, exports, module) {
231233
// Create the CodeMirror instance
232234
// (note: CodeMirror doesn't actually require using 'new', but jslint complains without it)
233235
this._codeMirror = new CodeMirror(container, {
234-
electricChars: false, // we use our own impl of this to avoid CodeMirror bugs; see _checkElectricChars()
235-
smartIndent: currentOptions[SMART_INDENT],
236-
indentWithTabs: currentOptions[USE_TAB_CHAR],
237-
tabSize: currentOptions[TAB_SIZE],
238-
indentUnit: currentOptions[USE_TAB_CHAR] ? currentOptions[TAB_SIZE] : currentOptions[SPACE_UNITS],
239-
lineNumbers: currentOptions[SHOW_LINE_NUMBERS],
240-
lineWrapping: currentOptions[WORD_WRAP],
241-
styleActiveLine: currentOptions[STYLE_ACTIVE_LINE],
242-
coverGutterNextToScrollbar: true,
243-
matchBrackets: true,
244-
matchTags: {bothTags: true},
245-
dragDrop: false,
246-
extraKeys: codeMirrorKeyMap,
247-
autoCloseBrackets: currentOptions[CLOSE_BRACKETS],
248-
autoCloseTags: currentOptions[CLOSE_TAGS],
249-
cursorScrollMargin: 3
236+
autoCloseBrackets : currentOptions[CLOSE_BRACKETS],
237+
autoCloseTags : currentOptions[CLOSE_TAGS],
238+
coverGutterNextToScrollbar : true,
239+
cursorScrollMargin : 3,
240+
dragDrop : false,
241+
electricChars : false, // we use our own impl of this to avoid CodeMirror bugs; see _checkElectricChars()
242+
extraKeys : codeMirrorKeyMap,
243+
indentUnit : currentOptions[USE_TAB_CHAR] ? currentOptions[TAB_SIZE] : currentOptions[SPACE_UNITS],
244+
indentWithTabs : currentOptions[USE_TAB_CHAR],
245+
lineNumbers : currentOptions[SHOW_LINE_NUMBERS],
246+
lineWrapping : currentOptions[WORD_WRAP],
247+
matchBrackets : true,
248+
matchTags : { bothTags: true },
249+
scrollPastEnd : !range && currentOptions[SCROLL_PAST_END],
250+
smartIndent : currentOptions[SMART_INDENT],
251+
styleActiveLine : currentOptions[STYLE_ACTIVE_LINE],
252+
tabSize : currentOptions[TAB_SIZE]
250253
});
251254

252255
// Can't get CodeMirror's focused state without searching for
@@ -1830,6 +1833,7 @@ define(function (require, exports, module) {
18301833

18311834
if (oldValue !== newValue) {
18321835
this._currentOptions[prefName] = newValue;
1836+
var useTabChar = this._currentOptions[USE_TAB_CHAR];
18331837

18341838
if (prefName === USE_TAB_CHAR) {
18351839
this._codeMirror.setOption(cmOptions[prefName], newValue);
@@ -1839,15 +1843,13 @@ define(function (require, exports, module) {
18391843
);
18401844
} else if (prefName === STYLE_ACTIVE_LINE) {
18411845
this._updateStyleActiveLine();
1846+
} else if (prefName === SCROLL_PAST_END && this._visibleRange) {
1847+
// Do not apply this option to inline editors
1848+
return;
1849+
} else if ((useTabChar && prefName === SPACE_UNITS) || (!useTabChar && prefName === TAB_SIZE)) {
1850+
// This change conflicts with the useTabChar setting, so do not change the CodeMirror option
1851+
return;
18421852
} else {
1843-
// Set the CodeMirror option as long as it's not a change
1844-
// that is in conflict with the useTabChar setting.
1845-
var useTabChar = this._currentOptions[USE_TAB_CHAR];
1846-
if ((useTabChar && prefName === SPACE_UNITS) ||
1847-
(!useTabChar && prefName === TAB_SIZE)) {
1848-
return;
1849-
}
1850-
18511853
this._codeMirror.setOption(cmOptions[prefName], newValue);
18521854
}
18531855

src/preferences/PreferenceStorage.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,13 @@ define(function (require, exports, module) {
218218
var rule = rules[key];
219219
if (!rule && prefCheckCallback) {
220220
rule = prefCheckCallback(key);
221+
} else if (prefCheckCallback) {
222+
// Check whether we have a new preference key-value pair
223+
// for an old preference.
224+
var newRule = prefCheckCallback(key, prefs[key]);
225+
if (newRule) {
226+
rule = _.cloneDeep(newRule);
227+
}
221228
}
222229
if (!rule) {
223230
console.warn("Preferences conversion for ", self._clientID, " has no rule for", key);
@@ -238,6 +245,11 @@ define(function (require, exports, module) {
238245
manager.set(newKey, prefs[key], options);
239246
convertedKeys.push(key);
240247
}
248+
} else if (_.isObject(rule)) {
249+
Object.keys(rule).forEach(function (ruleKey) {
250+
manager.set(ruleKey, rule[ruleKey]);
251+
});
252+
convertedKeys.push(key);
241253
} else {
242254
complete = false;
243255
}

src/styles/brackets_theme_default.less

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,8 @@
144144
*/
145145
.code-font() {
146146
color: @content-color;
147-
// line-height must be specified in px not em because the code font and line number font sizes are different.
148-
// Sizing via em will cause the code and line numbers to misalign
149-
line-height: 15px;
150147
font-size: 12px;
148+
line-height: 1.25;
151149
font-family: "SourceCodePro-Medium", "MS ゴシック", "MS Gothic", monospace;
152150
}
153151

0 commit comments

Comments
 (0)