* logic works the second time, we need to reset the
* selection.
*/
// Move range to beginning of token
input_.setSelection(new InputEditorSelection(
selection_.getStart().movePosition(-token_.length(), true),
input_.getSelection().getEnd()));
if (insertParen && !overrideInsertParens_ && !textFollowingCursorHasOpenParen)
{
// Don't replace the selection if the token ends with a ')'
// (implies an earlier replacement handled this)
if (token_.endsWith("("))
{
input_.setSelection(new InputEditorSelection(
input_.getSelection().getEnd(),
input_.getSelection().getEnd()));
}
else
{
input_.replaceSelection(value + "()", true);
InputEditorSelection newSelection = new InputEditorSelection(
input_.getSelection().getEnd().movePosition(-1, true));
token_ = value + "(";
selection_ = new InputEditorSelection(
input_.getSelection().getStart().movePosition(-2, true),
newSelection.getStart());
input_.setSelection(newSelection);
}
}
else