summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/src/utils/editor/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/debugger/src/utils/editor/index.js')
-rw-r--r--devtools/client/debugger/src/utils/editor/index.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/devtools/client/debugger/src/utils/editor/index.js b/devtools/client/debugger/src/utils/editor/index.js
index d12e2f29f1..e729388acf 100644
--- a/devtools/client/debugger/src/utils/editor/index.js
+++ b/devtools/client/debugger/src/utils/editor/index.js
@@ -11,6 +11,7 @@ import { createEditor } from "./create-editor";
import { isWasm, lineToWasmOffset, wasmOffsetToLine } from "../wasm";
import { createLocation } from "../location";
+import { features } from "../prefs";
let editor;
@@ -65,6 +66,10 @@ export function toEditorLine(sourceId, lineOrOffset) {
return wasmOffsetToLine(sourceId, lineOrOffset) || 0;
}
+ if (features.codemirrorNext) {
+ return lineOrOffset;
+ }
+
return lineOrOffset ? lineOrOffset - 1 : 1;
}
@@ -73,6 +78,10 @@ export function fromEditorLine(sourceId, line, sourceIsWasm) {
return lineToWasmOffset(sourceId, line) || 0;
}
+ if (features.codemirrorNext) {
+ return line;
+ }
+
return line + 1;
}
@@ -88,7 +97,13 @@ export function toEditorPosition(location) {
}
export function toSourceLine(sourceId, line) {
- return isWasm(sourceId) ? lineToWasmOffset(sourceId, line) : line + 1;
+ if (isWasm(sourceId)) {
+ return lineToWasmOffset(sourceId, line);
+ }
+ if (features.codemirrorNext) {
+ return line;
+ }
+ return line + 1;
}
export function scrollToPosition(codeMirror, line, column) {