[IPython-User] More candidates in qtconsole auto-completion

klo uo klonuo@gmail....
Fri Sep 21 04:43:38 CDT 2012

On Fri, Sep 21, 2012 at 9:31 AM, Matthias BUSSONNIER wrote:

> Yes, it is hard coded, not related to the qtconsole size.
> You would have to update the width of the completion_widget when resizing
> windows for the number of columns.
> This should not be too hard, just to bind the correct signal.
> The number of rows could just be made a Trait to be configurable[*].
> One of the reason to keep a "low" number of column is that with ultra wide
> qtconsole navigation become a pain.
> For example, with 16 completions, with 4 by 4 any item is at Manhattan
> distance of less than 4 than any other, instead of 8 for 1x16
> But I guess the current behavior could be improved for sure.

I looked in "completion_widget.py" but can't see anything that I can change.
I expected that maybe number of rows (which is now 8) can be tweaked, as
trying with columns sounds complicated.

I assure you that is would not be as you more easily see the differences
> when items are order vertically.
> =====================================
> api.getString                   api.getStrings
> =====================================
> vs
> =====================================
> api.getString
> api.getStrings
> =====================================
> especially for non native english readers.
> It would have been much more easier on implementation side to do so, but
> common shell like bash or zsh
> came across the same problem and decided to do it by column so I think
> this is the good choice.

If auto-complete functions were sorted alphabetically by row we would have
seen full 3 columns with 24 functions, while currently we see just 2 items
in 3rd column (in posted qtconsole example). For me it's easier to read
alphabetically sorted table by row in this case when table is clipped

as that's how cursor TAB interaction has been made.
> There is no good answer with how tab works.
> The behavior I came up with is quite tricky
> you might have seen that when going over the
> (1) edge on right it goes to next line,
> (2) at the end of a column with arrow it goes to next column.
> The problem here, is that when you have few completion (one line).
> You obviously want tab to cycle through your completions.
> So either you have it go horizontally, or vertically.
> Well obviously if vertical you want (2) otherwise you are stuck with the
> current completion when pressing tab.
> But this come with 2 drawbacks.
>   * First is that sometime tab make the cursor go horizontally (one
> completion line) , sometime vertically (several line completion),
>               and trust me your brain get confused and your visual memory
> hurts a lot.
>   * with several line completion (lets say 30) keeping tab press make the
> completion scroll, so it's unreadable
> But his is what zsh does, and it drives (at least me) crazy.
> Horizontal does indeed not cycle alphabetically, but is it really useful
> when you look for something ?
> You can still use the arrow keys if you want to move vertically.
> Writing this was much more complicated to do than I first thought, but
> I'll be happy if you find a better solution than mine.

I get you. I don't speak English too ;)
It's tricky when you think more about it. If I look for a function I can't
remember it's name I usually "know/suspect" the beginning and using TAB to
move through available function which aren't alphabetically sorted is
unintuitive for sure. But hey, I didn't know that arrow keys work, so
that's good thing to know ;)

 If you wan't to give a shot a making things configurable, or write your on
completer-gui, take a look at

> ipython/IPython/frontend/qt/console/completion_html.py
> ipython/IPython/frontend/qt/console/console_widget.py  :  L96
Yet another tip. That's great. I also didn't know about it.
So plain mode is just like auto-completion in terminal console, while there
is also drop-down control available!

Thanks again Matthias for your always insightful support

> Anyhow, can I configure qtconsole to roll more candidates on
> auto-completion?
> Well, for now you will have to digg in the code a little.
> but keep us informed or send a PR if you get something, or need more
> pointers.
> --
> Matthias

Case closed

Cheers :)

> [*] I'm not sure it will be strait forward to make it configurable as it
> inherit from QWidget, and you will have to set the metaclass to something
> like  MetaQObjectHasTraits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120921/cffd5f5b/attachment.html 

More information about the IPython-User mailing list