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

Commit ebb6b7a

Browse files
committed
More changes after review
1 parent a5a6394 commit ebb6b7a

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

src/view/ViewCommandHandlers.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ define(function (require, exports, module) {
9494
* @param {string} lineHeightStyle A string with the line height and the size unit
9595
*/
9696
function _addDynamicFontSize(fontSizeStyle, lineHeightStyle) {
97-
// It's necessary to inject a new rule to address all editors.
98-
_removeDynamicFontSize();
9997
var style = $("<style type='text/css'></style>").attr("id", DYNAMIC_FONT_STYLE_ID);
10098
style.html(".CodeMirror {" +
10199
"font-size: " + fontSizeStyle + " !important;" +
@@ -114,11 +112,10 @@ define(function (require, exports, module) {
114112
oldWidth = editor._codeMirror.defaultCharWidth(),
115113
scrollPos = editor.getScrollPos(),
116114
line = editor._codeMirror.lineAtHeight(scrollPos.y, "local");
117-
console.log(line);
115+
116+
_removeDynamicFontSize();
118117
if (fontSizeStyle && lineHeightStyle) {
119118
_addDynamicFontSize(fontSizeStyle, lineHeightStyle);
120-
} else {
121-
_removeDynamicFontSize();
122119
}
123120
editor.refreshAll();
124121

@@ -127,7 +124,7 @@ define(function (require, exports, module) {
127124
deltaX = scrollPos.x / oldWidth,
128125
scrollPosX = scrollPos.x + Math.round(deltaX * (newWidth - oldWidth)),
129126
scrollPosY = editor._codeMirror.heightAtLine(line, "local");
130-
console.log(scrollPosY);
127+
131128
editor.setScrollPos(scrollPosX, scrollPosY);
132129
}
133130

@@ -199,8 +196,8 @@ define(function (require, exports, module) {
199196
/** Restores the font size to the original size */
200197
function _handleRestoreFontSize() {
201198
_setSizeAndRestoreScroll();
202-
PreferencesManager.setViewState("fontSizeStyle", undefined);
203-
PreferencesManager.setViewState("lineHeightStyle", undefined);
199+
PreferencesManager.setViewState("fontSizeStyle");
200+
PreferencesManager.setViewState("lineHeightStyle");
204201
}
205202

206203

@@ -233,6 +230,7 @@ define(function (require, exports, module) {
233230
lhStr = PreferencesManager.getViewState("lineHeightStyle");
234231

235232
if (fsStr && lhStr) {
233+
_removeDynamicFontSize();
236234
_addDynamicFontSize(fsStr, lhStr);
237235
}
238236
}

0 commit comments

Comments
 (0)