Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 wasShown() { | 302 wasShown() { |
| 303 this._viewport.refresh(); | 303 this._viewport.refresh(); |
| 304 } | 304 } |
| 305 | 305 |
| 306 /** | 306 /** |
| 307 * @override | 307 * @override |
| 308 */ | 308 */ |
| 309 focus() { | 309 focus() { |
| 310 if (this._prompt.hasFocus()) | 310 if (this._prompt.hasFocus()) |
| 311 return; | 311 return; |
| 312 // Set caret position before setting focus in order to avoid scrolling | 312 // Restore scroll position after focus. |
| 313 // by focus(). | 313 var top = this._messagesElement.scrollTop; |
| 314 this._prompt.moveCaretToEndOfPrompt(); | 314 this._prompt.moveCaretToEndOfPrompt(); |
|
pfeldman
2017/04/25 18:26:08
below the prompt.
Could you elaborate on this? Is
luoe
2017/04/25 23:00:34
No, I really want the caret to move on messagesCli
| |
| 315 this._prompt.focus(); | 315 this._prompt.focus(); |
| 316 this._messagesElement.scrollTop = top; | |
| 316 } | 317 } |
| 317 | 318 |
| 318 /** | 319 /** |
| 319 * @override | 320 * @override |
| 320 */ | 321 */ |
| 321 restoreScrollPositions() { | 322 restoreScrollPositions() { |
| 322 if (this._viewport.stickToBottom()) | 323 if (this._viewport.stickToBottom()) |
| 323 this._immediatelyScrollToBottom(); | 324 this._immediatelyScrollToBottom(); |
| 324 else | 325 else |
| 325 super.restoreScrollPositions(); | 326 super.restoreScrollPositions(); |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1272 return true; | 1273 return true; |
| 1273 } | 1274 } |
| 1274 return false; | 1275 return false; |
| 1275 } | 1276 } |
| 1276 }; | 1277 }; |
| 1277 | 1278 |
| 1278 /** | 1279 /** |
| 1279 * @typedef {{messageIndex: number, matchIndex: number}} | 1280 * @typedef {{messageIndex: number, matchIndex: number}} |
| 1280 */ | 1281 */ |
| 1281 Console.ConsoleView.RegexMatchRange; | 1282 Console.ConsoleView.RegexMatchRange; |
| OLD | NEW |