Skip to content

Commit

Permalink
Fix #18 Proposal exit position should point to correct location
Browse files Browse the repository at this point in the history
It should point to $0 if present
  • Loading branch information
xcariba committed Aug 6, 2020
1 parent c5cba1e commit b30b70d
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,16 @@ protected void apply(IDocument document, char trigger, int stateMask, int offset

LinkedModeUI ui = new EditorLinkedModeUI(model, viewer);
// ui.setExitPolicy(new ExitPolicy(closingCharacter, document));
ui.setExitPosition(viewer, insertionOffset + textEdit.getNewText().length(), 0, Integer.MAX_VALUE);
List<LinkedPosition> exitPositions = regions.get(String.valueOf(0));
int exitOffset = 0;
int exitLength = 0;
if (exitPositions != null && exitPositions.size() == 1) {
exitOffset = exitPositions.get(0).getOffset();
exitLength = exitPositions.get(0).getLength();
} else {
exitOffset = insertionOffset + textEdit.getNewText().length();
}
ui.setExitPosition(viewer, exitOffset, exitLength, Integer.MAX_VALUE);
ui.setCyclingMode(LinkedModeUI.CYCLE_WHEN_NO_PARENT);
// ui.setDoContextInfo(true);
ui.enter();
Expand Down

0 comments on commit b30b70d

Please sign in to comment.