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

Commit

Permalink
Merge pull request #14 from adobe/nj/issue-3
Browse files Browse the repository at this point in the history
Get the focused editor when scanning for fonts instead of the current full editor
  • Loading branch information
gruehle committed Sep 18, 2012
2 parents d17ada5 + e2e1636 commit 6655f1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions cssFontParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ define(function (require, exports, module) {
var EditorManager = brackets.getModule("editor/EditorManager");
var webfont = require("webfont");

function parseCurrentFullEditor(assumeCursorInvalid) {
var cm = EditorManager.getCurrentFullEditor()._codeMirror;
function parseCurrentEditor(assumeCursorInvalid) {
var editor = EditorManager.getFocusedEditor() || EditorManager.getCurrentFullEditor();
var cm = editor._codeMirror;
var cursor = {ch: 0, line: 0}, t;
var userCursorLine = cm.getCursor().line;
var isParsingFontList = false, fontListStartLine;
Expand Down Expand Up @@ -120,6 +121,6 @@ define(function (require, exports, module) {
return result;
}

exports.parseCurrentFullEditor = parseCurrentFullEditor;
exports.parseCurrentEditor = parseCurrentEditor;
exports.getFontTokenAtCursor = getFontTokenAtCursor;
});
});
4 changes: 2 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ define(function (require, exports, module) {
* @return {Array.<string>}
*/
FontHints.prototype.search = function (query) {
var candidates = parser.parseCurrentFullEditor(true);
var candidates = parser.parseCurrentEditor(true);
candidates = candidates.concat(lastTwentyFonts);
candidates = candidates.concat(webfont.getWebsafeFonts());
candidates = webfont.lowerSortUniqStringArray(candidates);
Expand Down Expand Up @@ -302,7 +302,7 @@ define(function (require, exports, module) {
* configurator UI that lets users specify which variants and subsets they want
*/
function _handleGenerateInclude() {
var fonts = parser.parseCurrentFullEditor(false);
var fonts = parser.parseCurrentEditor(false);
var fontFamilies = [], allFvds = [];
var i, j, f;
var includeString = "";
Expand Down

0 comments on commit 6655f1d

Please sign in to comment.