diff --git a/canvas_modules/common-canvas/src/common-properties/controls/expression/expression-builder/expression-builder.jsx b/canvas_modules/common-canvas/src/common-properties/controls/expression/expression-builder/expression-builder.jsx index 2bf9c0327c..a7b56caf81 100644 --- a/canvas_modules/common-canvas/src/common-properties/controls/expression/expression-builder/expression-builder.jsx +++ b/canvas_modules/common-canvas/src/common-properties/controls/expression/expression-builder/expression-builder.jsx @@ -38,7 +38,7 @@ export default class ExpressionBuilder extends React.Component { const value = (typeof newValue === "string") ? newValue : newValue.toString(); const somethingSelected = this.getCodemirrorState()?.selection.ranges.some((r) => !r.empty); let cursor = this.getCodemirrorState()?.selection.main.head; - if (cursor === 0 && !somethingSelected) { // TODO: Doesn't work when I explicitly set the cursor to 0 + if (isNaN(cursor) && !somethingSelected) { // When nothing selected, set cursor at the end of the line this.editor.dispatch({ selection: { anchor: this.getCodemirrorState()?.doc.length } }); cursor = this.getCodemirrorState()?.selection.main.head;