OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 2003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2014 for (var lineNumber in this._updatedLines) | 2014 for (var lineNumber in this._updatedLines) |
2015 this._removeTextFromCompletionDictionary(this._updatedLines[line
Number]); | 2015 this._removeTextFromCompletionDictionary(this._updatedLines[line
Number]); |
2016 delete this._updatedLines; | 2016 delete this._updatedLines; |
2017 } | 2017 } |
2018 | 2018 |
2019 var linesToUpdate = {}; | 2019 var linesToUpdate = {}; |
2020 var singleCharInput = false; | 2020 var singleCharInput = false; |
2021 for (var changeIndex = 0; changeIndex < changes.length; ++changeIndex) { | 2021 for (var changeIndex = 0; changeIndex < changes.length; ++changeIndex) { |
2022 var changeObject = changes[changeIndex]; | 2022 var changeObject = changes[changeIndex]; |
2023 singleCharInput = (changeObject.origin === "+input" && changeObject.
text.length === 1 && changeObject.text[0].length === 1) || | 2023 singleCharInput = (changeObject.origin === "+input" && changeObject.
text.length === 1 && changeObject.text[0].length === 1) || |
2024 (changeObject.origin === "+delete" && changeObject.removed.lengt
h === 1 && changeObject.removed[0].length === 1); | 2024 (this._suggestBox && changeObject.origin === "+delete" && change
Object.removed.length === 1 && changeObject.removed[0].length === 1); |
2025 | 2025 |
2026 var editInfo = this._textEditor._changeObjectToEditOperation(changeO
bject); | 2026 var editInfo = this._textEditor._changeObjectToEditOperation(changeO
bject); |
2027 for (var i = editInfo.newRange.startLine; i <= editInfo.newRange.end
Line; ++i) | 2027 for (var i = editInfo.newRange.startLine; i <= editInfo.newRange.end
Line; ++i) |
2028 linesToUpdate[i] = this._textEditor.line(i); | 2028 linesToUpdate[i] = this._textEditor.line(i); |
2029 } | 2029 } |
2030 for (var lineNumber in linesToUpdate) | 2030 for (var lineNumber in linesToUpdate) |
2031 this._addTextToCompletionDictionary(linesToUpdate[lineNumber]); | 2031 this._addTextToCompletionDictionary(linesToUpdate[lineNumber]); |
2032 | 2032 |
2033 if (singleCharInput) | 2033 if (singleCharInput) |
2034 this.autocomplete(); | 2034 this.autocomplete(); |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2382 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; | 2382 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; |
2383 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); | 2383 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); |
2384 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; | 2384 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; |
2385 if (!foregroundColorRule && !backgroundColorRule) | 2385 if (!foregroundColorRule && !backgroundColorRule) |
2386 return; | 2386 return; |
2387 | 2387 |
2388 var style = document.createElement("style"); | 2388 var style = document.createElement("style"); |
2389 style.textContent = backgroundColorRule + foregroundColorRule; | 2389 style.textContent = backgroundColorRule + foregroundColorRule; |
2390 document.head.appendChild(style); | 2390 document.head.appendChild(style); |
2391 })(); | 2391 })(); |
OLD | NEW |