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 overlay now closes.

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

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

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

0 comments on commit 742846b

Please sign in to comment.