if (visualColumnToRestore < 0) {
} else {
CaretModel caretModel = editor.getCaretModel();
VisualPosition position = caretModel.getVisualPosition();
if (visualColumnToRestore != position.column) {
caretModel.moveToVisualPosition(new VisualPosition(position.line, visualColumnToRestore));
}
}
}
// There is a possible case that cursor is located at the end of the line that contains only white spaces. For