mirror of https://github.com/buggins/dlangide.git
fix focus after completion
This commit is contained in:
parent
115e20ba79
commit
8389e71459
|
@ -36,6 +36,7 @@ class DEditorTool : EditorTool
|
||||||
case DCDResult.FAIL:
|
case DCDResult.FAIL:
|
||||||
case DCDResult.DCD_NOT_RUNNING:
|
case DCDResult.DCD_NOT_RUNNING:
|
||||||
case DCDResult.NO_RESULT:
|
case DCDResult.NO_RESULT:
|
||||||
|
editor.setFocus();
|
||||||
return false;
|
return false;
|
||||||
case DCDResult.SUCCESS:
|
case DCDResult.SUCCESS:
|
||||||
auto target = to!int(output.output[1]);
|
auto target = to!int(output.output[1]);
|
||||||
|
@ -43,6 +44,7 @@ class DEditorTool : EditorTool
|
||||||
Log.d("Declaration is in current file. Jumping to it.");
|
Log.d("Declaration is in current file. Jumping to it.");
|
||||||
auto destPos = byteOffsetToCaret(content, target);
|
auto destPos = byteOffsetToCaret(content, target);
|
||||||
editor.setCaretPos(destPos.line,destPos.pos);
|
editor.setCaretPos(destPos.line,destPos.pos);
|
||||||
|
editor.setFocus();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//Must open file first to get the content for finding the correct caret position.
|
//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);
|
txt = toUTF8(_frame.currentEditor.text);
|
||||||
auto destPos = byteOffsetToCaret(txt, target);
|
auto destPos = byteOffsetToCaret(txt, target);
|
||||||
_frame.currentEditor.setCaretPos(destPos.line,destPos.pos);
|
_frame.currentEditor.setCaretPos(destPos.line,destPos.pos);
|
||||||
|
_frame.currentEditor.setFocus();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -123,6 +123,7 @@ class DSourceEdit : SourceEdit {
|
||||||
void showCompletionPopup(dstring[] suggestions) {
|
void showCompletionPopup(dstring[] suggestions) {
|
||||||
|
|
||||||
if(suggestions.length == 0) {
|
if(suggestions.length == 0) {
|
||||||
|
setFocus();
|
||||||
return;
|
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);
|
PopupWidget popup = window.showPopup(popupMenu, this, PopupAlign.Point | PopupAlign.Right, textPosToClient(_caretPos).left + left + _leftPaneWidth, textPosToClient(_caretPos).top + top + margins.top);
|
||||||
popup.setFocus();
|
popup.setFocus();
|
||||||
|
popup.onPopupCloseListener = delegate(PopupWidget source) { setFocus(); };
|
||||||
popup.flags = PopupFlags.CloseOnClickOutside;
|
popup.flags = PopupFlags.CloseOnClickOutside;
|
||||||
|
|
||||||
Log.d("Showing popup at ", textPosToClient(_caretPos).left, " ", textPosToClient(_caretPos).top);
|
Log.d("Showing popup at ", textPosToClient(_caretPos).left, " ", textPosToClient(_caretPos).top);
|
||||||
|
|
Loading…
Reference in New Issue