commit 664775850ccd89df9128db134d345868ef99bfb1 parent 7eed621ff220c3baf8e592ef9789e32f78712180 Author: Hubert Boma Manilla <hmanilla@mozilla.com> Date: Mon, 6 Oct 2025 12:24:21 +0000 Bug 1988710 - [devtools] Should scroll by default when setting the cursor r=devtools-reviewers,nchevobbe Differential Revision: https://phabricator.services.mozilla.com/D267381 Diffstat:
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/devtools/client/debugger/src/components/Editor/index.js b/devtools/client/debugger/src/components/Editor/index.js @@ -648,7 +648,7 @@ class Editor extends PureComponent { if (this.props.shouldHighlightSelectedLocation) { editor.focus(); } - + // This should also scroll the editor to the specified position await editor.setCursorAt(line, column); } diff --git a/devtools/client/debugger/test/mochitest/shared-head.js b/devtools/client/debugger/test/mochitest/shared-head.js @@ -2365,7 +2365,6 @@ async function waitForCursorPosition(dbg, expectedLine) { * @returns {Promise} */ async function setEditorCursorAt(dbg, line, column) { - scrollEditorIntoView(dbg, line, 0); const cursorSet = waitForCursorPosition(dbg, line); await getCMEditor(dbg).setCursorAt(line, column); return cursorSet; diff --git a/devtools/client/netmonitor/src/components/previews/SourcePreview.js b/devtools/client/netmonitor/src/components/previews/SourcePreview.js @@ -111,7 +111,6 @@ class SourcePreview extends Component { // scroll the editor to center the line // with the target search result if (this.editor) { - await this.editor.scrollTo(line, 0); await this.editor.setCursorAt(line, 0); // Highlight line diff --git a/devtools/client/shared/sourceeditor/editor.js b/devtools/client/shared/sourceeditor/editor.js @@ -3628,11 +3628,13 @@ class Editor extends EventEmitter { /** * Move CodeMirror cursor to a given location. + * This will also scroll the editor to the specified position. * Used only for CM6 * @param {Number} line * @param {Number} column */ - setCursorAt(line, column) { + async setCursorAt(line, column) { + await this.scrollTo(line, column); const cm = editors.get(this); const { lines } = cm.state.doc; if (line > lines) {