Making Codemirror 6 respect indent for wrapped lines

Is there an analogous way to handle line-wrapping with indent in CodeMirror6, similar to how it’s done in the previous versions of CodeMirror? (As shown in this demo: CodeMirror: Indented wrapped line demo). What would be the analogous version of “renderLine”?

I made some progress and attempted to do this by applying the same styling changes as in the previous version to each line in the Viewport.

            EditorView.lineWrapping,
            EditorView.updateListener.of(update => {
              const view = update.view
              var charWidth = view.defaultCharacterWidth
              var basePadding = 4
              view.viewportLines(line => {
                // get the element for each line
                const domAtPos = view.domAtPos(line.from);
                
                // get the actual line
                const lineObj = view.state.doc.lineAt(line.from);

                const tabSize = view.state.tabSize;

                // get the offset width
                const off = countColumn(lineObj.text, 0, tabSize) * charWidth;
                
                // apply the styling changes
                domAtPos.node.style.textIndent = "-" + off + "px";
                domAtPos.node.style.paddingLeft = (basePadding + off) + "px";

                console.log(line);
                console.log("tabSize: " + tabSize)
                console.log("charWidth: " + charWidth)
                console.log(off)
              })
            }),

However, this seems to somehow cause the line-wrapping behavior to break completely. Do you have any suggestions?

Never mind, I’ve realized that the countColumn method from Text is not the same as the countColumn method in CodeMirror from the previous version. Using the old countColumn did the trick.