[Patches] [ python-Patches-1621265 ] Auto-completion list placement

SourceForge.net noreply at sourceforge.net
Wed Feb 7 04:47:06 CET 2007


Patches item #1621265, was opened at 2006-12-23 08:16
Message generated for change (Comment added) made by kbk
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1621265&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: IDLE
Group: Python 2.6
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Tal Einat (taleinat)
Assigned to: Kurt B. Kaiser (kbk)
Summary: Auto-completion list placement

Initial Comment:
The completion list placement logic is currently very primitive. Sometimes the completion list extends outside of the editor window, or even outside the screen so that part of it is not visible.

This patch places the completion list inside the text widget if possible, above or below the typed text, as appropriate. It will not hide the currently typed text in any case.

End-cases:
* If the text widget is not high enough, the completion list is placed below the currently typed text.
* If the text widget is not wide enough, the completion list is aligned with the left-most edge of the text widget.

In any case the size of the completion list is not altered to fit the text widget, though this would probably be the best solution when the text widget is too small. This means that with this patch, the completion list may extend beyond the text widget if it is small.

I have not implemented resizing of the list this since the list's size is currently not set at all - Tk's default is used. Changing it anywhere in the code would require setting it elsewhere, hard-coding a default or making it configurable, etc.

Comments please!

----------------------------------------------------------------------

>Comment By: Kurt B. Kaiser (kbk)
Date: 2007-02-06 22:47

Message:
Logged In: YES 
user_id=149084
Originator: NO

Rev 53653
Thanks for the patch!

I agree with your comment about the completion logic.  I would have
thought that by now someone from Noam's enthusiast group would have sent a
patch.

If there's only one completion, a tab should complete it.  If there is a
mouse selection in the ACW, it should be chosen.  If an up/down cursor key
is used to change the ACW selection, the selection should be chosen. 
Otherwise, the closest match in the ACW window to what's been typed should
be highlighted.  I'm looking at it.  Any comments on this?

The change to the completion logic prevented a loop, but as you say, the
logic was buggy to begin with.

----------------------------------------------------------------------

Comment By: Tal Einat (taleinat)
Date: 2007-02-05 07:03

Message:
Logged In: YES 
user_id=1330769
Originator: YES

My mistake - I missed the changes at the top! I meant only to patch the
placement mechanism.

The newly attached patch includes only the fix for window placement.


BTW, that change to the completion logic seems buggy - if a duplicate
completion entry is selected, only one more letter (if available) will be
added?

IMO the current completion logic is weird and non-intuitive. When
selecting a completion from the list (in any way) I would expect it all to
appear where I am typing, not just some of it...
File Added: AutoCompleteWindow.placement.070205.patch

----------------------------------------------------------------------

Comment By: Kurt B. Kaiser (kbk)
Date: 2007-02-04 23:16

Message:
Logged In: YES 
user_id=149084
Originator: NO

Haven't you introduced a regression on [ 1571112 ] simple moves freeze
IDLE by the changes at the beginning of the patch?  Also, the assignment to
previous_completion was intended to make the code clearer.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1621265&group_id=5470


More information about the Patches mailing list