}
PySelection ps = new PySelection(document, new TextSelection(document, command.offset, command.length));
if (command.length > 0) {
try {
//We have more contents selected. Delete it so that we can properly use the heuristics.
ps.deleteSelection();
command.length = 0;
ps.setSelection(command.offset, command.offset);
} catch (BadLocationException e) {
}
}