Changeset 186217 in webkit
- Timestamp:
- Jul 1, 2015 9:30:53 PM (9 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r186212 r186217 1 2015-07-01 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: When autocompleting, pressing tab twice shouldn't insert a tab character 4 https://bugs.webkit.org/show_bug.cgi?id=145885 5 6 Reviewed by Timothy Hatcher. 7 8 * UserInterface/Controllers/CodeMirrorCompletionController.js: 9 (WebInspector.CodeMirrorCompletionController): 10 (WebInspector.CodeMirrorCompletionController.prototype.updateCompletions): Resolves the promise as having completions. 11 (WebInspector.CodeMirrorCompletionController.prototype.hideCompletions): Resolves the promise as not having completions. 12 (WebInspector.CodeMirrorCompletionController.prototype.completeAtCurrentPositionIfNeeded): Returns a WrappedPromise that allows 13 callers of this function to determine if the autocomplete had any values or was instead not shown. 14 (WebInspector.CodeMirrorCompletionController.prototype._resolveUpdatePromise): 15 * UserInterface/Main.html: Added WrappedPromise class. 16 * UserInterface/Models/WrappedPromise.js: Added WrappedPromise object to expose resolve and reject functions. 17 * UserInterface/Views/ConsolePrompt.js: 18 (WebInspector.ConsolePrompt.prototype._handleTabKey): Attempts to find completions for current text. If there are none, beep. 19 1 20 2015-07-01 Devin Rousso <drousso@apple.com> 2 21 -
trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js
r185935 r186217 69 69 this._codeMirror.on("blur", this._handleHideActionListener); 70 70 this._codeMirror.on("scroll", this._handleHideActionListener); 71 72 this._updatePromise = null; 71 73 } 72 74 … … 126 128 127 129 this._applyCompletionHint(completions[index]); 130 131 this._resolveUpdatePromise(WebInspector.CodeMirrorCompletionController.UpdatePromise.CompletionsFound); 128 132 } 129 133 … … 159 163 delete this._currentCompletion; 160 164 delete this._ignoreNextCursorActivity; 165 166 this._resolveUpdatePromise(WebInspector.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound); 161 167 } 162 168 … … 171 177 } 172 178 179 completeAtCurrentPositionIfNeeded(force) 180 { 181 this._resolveUpdatePromise(WebInspector.CodeMirrorCompletionController.UpdatePromise.Canceled); 182 183 var update = this._updatePromise = new WebInspector.WrappedPromise; 184 185 this._completeAtCurrentPosition(force); 186 187 return update.promise; 188 } 189 173 190 // Protected 174 191 … … 193 210 194 211 // Private 212 213 _resolveUpdatePromise(message) 214 { 215 if (!this._updatePromise) 216 return; 217 218 this._updatePromise.resolve(message); 219 this._updatePromise = null; 220 } 195 221 196 222 get _currentReplacementText() … … 803 829 }; 804 830 831 WebInspector.CodeMirrorCompletionController.UpdatePromise = { 832 Canceled: "code-mirror-completion-controller-canceled", 833 CompletionsFound: "code-mirror-completion-controller-completions-found", 834 NoCompletionsFound: "code-mirror-completion-controller-no-completions-found" 835 }; 836 805 837 WebInspector.CodeMirrorCompletionController.GenericStopCharactersRegex = /[\s=:;,]/; 806 838 WebInspector.CodeMirrorCompletionController.DefaultStopCharactersRegexModeMap = {"css": /[\s:;,{}()]/, "javascript": /[\s=:;,!+\-*/%&|^~?<>.{}()[\]]/}; -
trunk/Source/WebInspectorUI/UserInterface/Main.html
r185044 r186217 311 311 <script src="Models/TypeSet.js"></script> 312 312 <script src="Models/UnitBezier.js"></script> 313 <script src="Models/WrappedPromise.js"></script> 313 314 314 315 <script src="Views/ConsoleCommandView.js"></script> -
trunk/Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.js
r184819 r186217 52 52 "Enter": this._handleEnterKey.bind(this), 53 53 "Cmd-Enter": this._handleCommandEnterKey.bind(this), 54 "Tab": this._handleTabKey.bind(this), 54 55 "Esc": this._handleEscapeKey.bind(this) 55 56 }; … … 164 165 165 166 // Private 167 168 _handleTabKey: function(codeMirror) 169 { 170 this._completionController.completeAtCurrentPositionIfNeeded().then(function(result) { 171 if (result === WebInspector.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound) 172 InspectorFrontendHost.beep(); 173 }); 174 }, 166 175 167 176 _handleEscapeKey: function(codeMirror)
Note: See TracChangeset
for help on using the changeset viewer.