fix focus after completion

This commit is contained in:
Vadim Lopatin 2015-02-17 16:09:30 +03:00
parent 115e20ba79
commit 8389e71459
2 changed files with 5 additions and 0 deletions

View File

@ -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:

View File

@ -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);