void (@NotNull Editor editor, @Nullable SoftWrapAppliancePlaces places, boolean state) { Point point = editor.getScrollingModel().getVisibleArea().getLocation(); LogicalPosition anchorPosition = editor.xyToLogicalPosition(point); int intraLineShift = point.y - editor.logicalPositionToXY(anchorPosition).y; if (places != null) { EditorSettingsExternalizable.getInstance().setUseSoftWraps(state, places); EditorFactory.getInstance().refreshAllEditors(); } if (editor.getSettings().isUseSoftWraps() != state) { editor.getSettings().setUseSoftWraps(state); if (!state && Boolean.TRUE.equals(editor.getUserData(EditorImpl.FORCED_SOFT_WRAPS))) { editor.putUserData(EditorImpl.FORCED_SOFT_WRAPS, Boolean.FALSE); } } editor.getScrollingModel().disableAnimation(); editor.getScrollingModel().scrollVertically(editor.logicalPositionToXY(anchorPosition).y + intraLineShift); editor.getScrollingModel().enableAnimation(); }