class: EditTextViewCompletionSupport
changed: #openCompletionView:
changed reposition algorithm (to ensure popup is visible,
but not over current cursor position)
--- a/EditTextViewCompletionSupport.st Wed May 21 10:06:33 2014 +0200
+++ b/EditTextViewCompletionSupport.st Wed May 21 10:10:21 2014 +0200
@@ -268,13 +268,13 @@
openCompletionView: list
"Makes sure the completion view is opened and with given `list`."
- | movePos topView limit |
+ | cursorPos movePos topView limit |
"/ move the window
- movePos := editView device translatePoint:(editView xOfCursor @ editView yOfCursor) fromView:editView toView:nil.
- movePos := movePos - (editView viewOrigin x @ 0).
+ cursorPos := editView device translatePoint:(editView xOfCursor @ editView yOfCursor) fromView:editView toView:nil.
+ cursorPos := cursorPos - (editView viewOrigin x @ 0).
"/ currently, we have to stay away a bit, to avoid getting the focus
- movePos := movePos + (60 @ (editView font height)).
+ movePos := cursorPos + (60 @ (editView font height)).
completionView isNil ifTrue:[
completionView := CodeCompletionHelpMenuView new.
@@ -298,10 +298,10 @@
"/ make sure, the window is visible
limit := topView device monitorBoundsAt:topView origin.
movePos x + topView extent x > limit corner x ifTrue:[
- movePos := (movePos x - (topView extent x * 2)) @ movePos y.
+ movePos := (cursorPos x - 60 - (topView extent x)) @ movePos y.
].
movePos y + topView extent y > limit corner y ifTrue:[
- movePos := movePos x @ (movePos y - (topView extent y * 2)).
+ movePos := movePos x @ (cursorPos y - (topView extent y)).
].
topView origin:movePos.
].
@@ -312,10 +312,10 @@
!EditTextViewCompletionSupport class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.8 2014-05-21 08:06:33 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.9 2014-05-21 08:10:21 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.8 2014-05-21 08:06:33 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.9 2014-05-21 08:10:21 cg Exp $'
! !