diff --git a/src/dlangide/tools/d/deditortool.d b/src/dlangide/tools/d/deditortool.d index 60e4184..c3acc30 100644 --- a/src/dlangide/tools/d/deditortool.d +++ b/src/dlangide/tools/d/deditortool.d @@ -36,6 +36,7 @@ class DEditorTool : EditorTool case DCDResult.FAIL: case DCDResult.DCD_NOT_RUNNING: case DCDResult.NO_RESULT: + editor.setFocus(); return false; case DCDResult.SUCCESS: auto target = to!int(output.output[1]); @@ -43,6 +44,7 @@ class DEditorTool : EditorTool Log.d("Declaration is in current file. Jumping to it."); auto destPos = byteOffsetToCaret(content, target); editor.setCaretPos(destPos.line,destPos.pos); + editor.setFocus(); } else { //Must open file first to get the content for finding the correct caret position. @@ -51,6 +53,7 @@ class DEditorTool : EditorTool txt = toUTF8(_frame.currentEditor.text); auto destPos = byteOffsetToCaret(txt, target); _frame.currentEditor.setCaretPos(destPos.line,destPos.pos); + _frame.currentEditor.setFocus(); } return true; default: diff --git a/src/dlangide/ui/dsourceedit.d b/src/dlangide/ui/dsourceedit.d index ec43bb0..1ac1aa1 100644 --- a/src/dlangide/ui/dsourceedit.d +++ b/src/dlangide/ui/dsourceedit.d @@ -123,6 +123,7 @@ class DSourceEdit : SourceEdit { void showCompletionPopup(dstring[] suggestions) { if(suggestions.length == 0) { + setFocus(); return; } @@ -141,6 +142,7 @@ class DSourceEdit : SourceEdit { PopupWidget popup = window.showPopup(popupMenu, this, PopupAlign.Point | PopupAlign.Right, textPosToClient(_caretPos).left + left + _leftPaneWidth, textPosToClient(_caretPos).top + top + margins.top); popup.setFocus(); + popup.onPopupCloseListener = delegate(PopupWidget source) { setFocus(); }; popup.flags = PopupFlags.CloseOnClickOutside; Log.d("Showing popup at ", textPosToClient(_caretPos).left, " ", textPosToClient(_caretPos).top);