void () { String text = """ class Test { public String s = "this is a long string literal that is expected to be soft-wrapped into multiple visual lines"; \s }"""; init(30, text, false); getEditor().getCaretModel().moveToOffset(text.indexOf("\n") + 1); checkSoftWraps(41, 66, 89, 116); CaretModel caretModel = getEditor().getCaretModel(); end(); assertEquals(40, caretModel.getOffset()); assertEquals(new VisualPosition(1, 27), caretModel.getVisualPosition()); end(); assertEquals(41, caretModel.getOffset()); assertEquals(new VisualPosition(1, 28), caretModel.getVisualPosition()); // Check that caret is placed on a last non-white space symbol on current logical line. end(); int lastNonWhiteSpaceSymbolOffset = text.indexOf("\";") + 2; assertEquals(lastNonWhiteSpaceSymbolOffset, caretModel.getOffset()); assertEquals(getEditor().offsetToVisualPosition(lastNonWhiteSpaceSymbolOffset), caretModel.getVisualPosition()); // Check that caret is place to the very end of the logical line. end(); int lastSymbolOffset = getEditor().getDocument().getLineEndOffset(caretModel.getLogicalPosition().line); assertEquals(lastSymbolOffset, caretModel.getOffset()); assertEquals(getEditor().offsetToVisualPosition(lastSymbolOffset), caretModel.getVisualPosition()); }