Title: [191454] trunk/Source/WebInspectorUI
- Revision
- 191454
- Author
- [email protected]
- Date
- 2015-10-22 08:48:09 -0700 (Thu, 22 Oct 2015)
Log Message
Web Inspector: Tabbing over CSS properties prepended by * doesn't move the highlighted range
https://bugs.webkit.org/show_bug.cgi?id=150294
Patch by Devin Rousso <[email protected]> on 2015-10-22
Reviewed by Timothy Hatcher.
Moving the selected text when tabbing and shift-tabbing now relies upon
the last index of ";" if it exists instead of whether the line ends with it.
* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor.prototype._handleShiftTabKey):
(WebInspector.CSSStyleDeclarationTextEditor.prototype._handleTabKey):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (191453 => 191454)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-10-22 14:24:57 UTC (rev 191453)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-10-22 15:48:09 UTC (rev 191454)
@@ -1,3 +1,17 @@
+2015-10-22 Devin Rousso <[email protected]>
+
+ Web Inspector: Tabbing over CSS properties prepended by * doesn't move the highlighted range
+ https://bugs.webkit.org/show_bug.cgi?id=150294
+
+ Reviewed by Timothy Hatcher.
+
+ Moving the selected text when tabbing and shift-tabbing now relies upon
+ the last index of ";" if it exists instead of whether the line ends with it.
+
+ * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+ (WebInspector.CSSStyleDeclarationTextEditor.prototype._handleShiftTabKey):
+ (WebInspector.CSSStyleDeclarationTextEditor.prototype._handleTabKey):
+
2015-10-21 Joseph Pecoraro <[email protected]>
Web Inspector: srcset attributes should have hyperlinks to the resources
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (191453 => 191454)
--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js 2015-10-22 14:24:57 UTC (rev 191453)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js 2015-10-22 15:48:09 UTC (rev 191454)
@@ -560,29 +560,28 @@
return CodeMirror.Pass;
}
- var cursor = codeMirror.getCursor();
- var line = codeMirror.getLine(cursor.line);
- var previousLine = codeMirror.getLine(cursor.line - 1);
+ let cursor = codeMirror.getCursor();
+ let line = codeMirror.getLine(cursor.line);
+ let previousLine = codeMirror.getLine(cursor.line - 1);
if (!line && !previousLine && !cursor.line)
return switchRule.call(this);
- var trimmedPreviousLine = previousLine ? previousLine.trimRight() : "";
- var previousAnchor;
- var previousHead;
- var isComment = this._textAtCursorIsComment(codeMirror, cursor);
+ let trimmedPreviousLine = previousLine ? previousLine.trimRight() : "";
+ let previousAnchor = 0;
+ let previousHead = line.length;
+ let isComment = this._textAtCursorIsComment(codeMirror, cursor);
if (cursor.ch === line.indexOf(":") || line.indexOf(":") < 0 || isComment) {
if (previousLine) {
--cursor.line;
+ previousHead = trimmedPreviousLine.length;
- if (this._textAtCursorIsComment(codeMirror, cursor)) {
- previousAnchor = 0;
- previousHead = trimmedPreviousLine.length;
- } else {
- var colon = /(?::\s*)/.exec(previousLine);
+ if (!this._textAtCursorIsComment(codeMirror, cursor)) {
+ let colon = /(?::\s*)/.exec(previousLine);
previousAnchor = colon ? colon.index + colon[0].length : 0;
- previousHead = trimmedPreviousLine.length - trimmedPreviousLine.endsWith(";");
+ if (trimmedPreviousLine.includes(";"))
+ previousHead = trimmedPreviousLine.lastIndexOf(";");
}
codeMirror.setSelection({line: cursor.line, ch: previousAnchor}, {line: cursor.line, ch: previousHead});
@@ -597,11 +596,8 @@
return switchRule.call(this);
}
- if (isComment) {
- previousAnchor = 0;
- previousHead = line.length;
- } else {
- var match = /(?:[^:;\s]\s*)+/.exec(line);
+ if (!isComment) {
+ let match = /(?:[^:;\s]\s*)+/.exec(line);
previousAnchor = match.index;
previousHead = previousAnchor + match[0].length;
}
@@ -620,12 +616,12 @@
return CodeMirror.Pass;
}
- var cursor = codeMirror.getCursor();
- var line = codeMirror.getLine(cursor.line);
- var trimmedLine = line.trimRight();
- var lastLine = cursor.line === codeMirror.lineCount() - 1;
- var nextLine = codeMirror.getLine(cursor.line + 1);
- var trimmedNextLine = nextLine ? nextLine.trimRight() : "";
+ let cursor = codeMirror.getCursor();
+ let line = codeMirror.getLine(cursor.line);
+ let trimmedLine = line.trimRight();
+ let lastLine = cursor.line === codeMirror.lineCount() - 1;
+ let nextLine = codeMirror.getLine(cursor.line + 1);
+ let trimmedNextLine = nextLine ? nextLine.trimRight() : "";
if (!trimmedLine.trimLeft().length) {
if (lastLine)
@@ -647,16 +643,17 @@
return;
}
- var hasEndingSemicolon = trimmedLine.endsWith(";");
+ let hasEndingSemicolon = trimmedLine.endsWith(";");
+ let pastLastSemicolon = line.includes(";") && cursor.ch >= line.lastIndexOf(";");
- if (cursor.ch >= line.trimRight().length - hasEndingSemicolon) {
+ if (cursor.ch >= line.trimRight().length - hasEndingSemicolon || pastLastSemicolon) {
this._completionController.completeAtCurrentPositionIfNeeded().then(function(result) {
if (result !== WebInspector.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound)
return;
- var replacement = "";
+ let replacement = "";
- if (!hasEndingSemicolon && !this._textAtCursorIsComment(codeMirror, cursor))
+ if (!hasEndingSemicolon && !pastLastSemicolon && !this._textAtCursorIsComment(codeMirror, cursor))
replacement += ";";
if (lastLine)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes