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

Commit

Permalink
respond to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffryBooher committed Apr 7, 2014
1 parent fc634da commit b4e0dad
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/editor/EditorCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ define(function (require, exports, module) {
var result, text, line;

// Move the context to the first non-empty token.
if (!ctx.token.type && ctx.token.string.trim().length === 0) {
if (!ctx.token.type && !/\S/.test(ctx.token.string)) {
result = TokenUtils.moveSkippingWhitespace(TokenUtils.moveNextToken, ctx);
}

Expand Down
2 changes: 1 addition & 1 deletion src/extensions/default/JavaScriptCodeHints/Session.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ define(function (require, exports, module) {
break;
}
prev = this.getToken(cursor);
} while (prev.string.trim() === "");
} while (!/\S/.test(prev.string));

return prev;
};
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/default/JavaScriptQuickEdit/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ define(function (require, exports, module) {

// If the pos is at the beginning of a name, token will be the
// preceding whitespace or dot. In that case, try the next pos.
if (token.string.trim().length === 0 || token.string === ".") {
if (!/\S/.test(token.string) || token.string === ".") {
token = hostEditor._codeMirror.getTokenAt({line: pos.line, ch: pos.ch + 1}, true);
}

Expand Down
2 changes: 1 addition & 1 deletion src/language/CSSUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ define(function (require, exports, module) {
result.push(entry);
} else if (!classOrIdSelector) {
// Special case for tag selectors - match "*" as the rightmost character
if (/.*\*\s*$/.test(entry.selector)) {
if (/\*\s*$/.test(entry.selector)) {
result.push(entry);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/language/HTMLUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ define(function (require, exports, module) {
}
// If we type the first letter of the next attribute, it comes as an error
// token. We need to double check for possible invalidated attributes.
if (forwardCtx.token.string.trim() !== "" &&
if (/\S/.test(forwardCtx.token.string) !== "" &&
forwardCtx.token.string.indexOf("\"") === -1 &&
forwardCtx.token.string.indexOf("'") === -1 &&
forwardCtx.token.string.indexOf("=") === -1) {
Expand Down Expand Up @@ -316,7 +316,7 @@ define(function (require, exports, module) {
}

//check and see where we are in the tag
if (ctx.token.string.length > 0 && ctx.token.string.trim().length === 0) {
if (ctx.token.string.length > 0 && !/\S/.test(ctx.token.string)) {

// token at (i.e. before) pos is whitespace, so test token at next pos
//
Expand All @@ -326,7 +326,7 @@ define(function (require, exports, module) {
var testPos = {ch: ctx.pos.ch + 1, line: ctx.pos.line},
testToken = editor._codeMirror.getTokenAt(testPos, true);

if (testToken.string.length > 0 && testToken.string.trim().length > 0 &&
if (testToken.string.length > 0 && /\S/.test(testToken.string) &&
testToken.string.charAt(0) !== ">") {
// pos has whitespace before it and non-whitespace after it, so use token after
ctx.token = testToken;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/TokenUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ define(function (require, exports, module) {
if (!moveFxn(ctx)) {
return false;
}
while (!ctx.token.type && ctx.token.string.trim().length === 0) {
while (!ctx.token.type && !/\S/.test(ctx.token.string)) {
if (!moveFxn(ctx)) {
return false;
}
Expand Down

0 comments on commit b4e0dad

Please sign in to comment.