Skip to content

Commit

Permalink
Find/Replace Overlay: close when escape is pressed in the editor
Browse files Browse the repository at this point in the history
When escape is pressed inside of the editor which is targeted by the
find/replace overlay, the overly now closes.

fixes #2033
  • Loading branch information
Maximilian Wittmer authored and Maximilian Wittmer committed Jul 6, 2024
1 parent 44dc49e commit 1ca070c
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ private void focusTargetWidget() {
targetWidget.forceFocus();
}
};
private KeyListener closeOnEditorEscapeListener = KeyListener.keyPressedAdapter(c -> {
if (c.keyCode == SWT.ESC) {
this.close();
}
});

private boolean isPartCurrentlyDisplayedInPartSash() {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
Expand Down Expand Up @@ -410,6 +415,7 @@ private void unbindListeners() {
if (targetWidget != null) {
targetWidget.getShell().removeControlListener(shellMovementListener);
targetWidget.removePaintListener(widgetMovementListener);
targetWidget.removeKeyListener(closeOnEditorEscapeListener);
targetPart.getSite().getPage().removePartListener(partListener);
}
}
Expand All @@ -422,6 +428,7 @@ private void bindListeners() {

targetWidget.getShell().addControlListener(shellMovementListener);
targetWidget.addPaintListener(widgetMovementListener);
targetWidget.addKeyListener(closeOnEditorEscapeListener);
targetPart.getSite().getPage().addPartListener(partListener);
}
}
Expand Down

0 comments on commit 1ca070c

Please sign in to comment.