CM6 failing unit test 'properly handles line motion when not focused' on macOS/Safari


Error: 11 != 10 [snip]

As this is just one of two CM6 view tests failing on Safari today (yesterday it was about 30 but the error messages pointed to something not being selected and either the changes I pulled in today fixed those, or my Safari window is somehow getting focus differently), maybe this is something worth nailing down too.

Note: the same test code passed when the editor had focus. It is only the focus==false case that isn’t passing.

    function testLineMotion(focus) {
        var cm = tempEditor("one two\nthree\nتممين");
        if (focus)
        ist_1(cm.movePos(0, "forward", "line"), 8);
        ist_1(cm.movePos(1, "forward", "line"), 9);
        ist_1(cm.movePos(7, "forward", "line"), 13);
        var last = cm.movePos(10, "forward", "line");
        ist_1(last, 19, "<");
        ist_1(last, 14, ">");
        cm.dispatch(cm.state.t().setSelection(EditorSelection.single(1))); // Clear goal columns
        ist_1(cm.movePos(last, "backward", "line"), 10); // <-- When focus==false, this movePos returns 11 on my macOS/Safari.
        ist_1(cm.movePos(12, "backward", "line"), 4);
        ist_1(cm.movePos(13, "backward", "line"), 5);
        ist_1(cm.movePos(8, "backward", "line"), 0);


Could you please open issues on the issue tracker instead of using forum threads? That makes them easier for us to keep track of.


Will do. Issue tracker it is. Please feel free to delete this issue from discussions. My feelings won’t be hurt.