Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #32882

how-to use readline.set_completion_display_matches_hook()?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <j-p@sunrise.ch>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.046
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'example:': 0.03; 'messages.': 0.04; 'python': 0.09; 'tab': 0.09; 'def': 0.10; '"test': 0.16; '2.7.3': 0.16; 'function"': 0.16; 'ubuntu.': 0.16; 'tests': 0.18; 'all,': 0.21; "i've": 0.23; 'message- id:@mail.gmail.com': 0.27; 'prints': 0.29; 'readline': 0.29; "i'm": 0.29; 'function': 0.30; 'mac': 0.32; 'print': 0.32; 'skip:s 30': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'done': 0.34; 'thanks': 0.34; 'received:209.85': 0.35; 'created': 0.36; 'tool': 0.36; 'but': 0.36; 'should': 0.36; 'display': 0.36; 'correctly': 0.37; 'does': 0.37; 'received:209': 0.37; 'registered': 0.38; 'skip:l 20': 0.38; 'some': 0.38; 'system.': 0.39; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'called': 0.39; 'subject:-': 0.40; 'help': 0.40; 'enable': 0.60; 'your': 0.60; 'received:194': 0.61; 'received:ch': 0.69; 'press': 0.71; 'completion': 0.78; 'prompt': 0.78; 'received:209.85.214.198': 0.84; 'received:mail- ob0-f198.google.com': 0.84
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :x-gm-message-state; bh=yzozMSLzmTIrm3dtCcGMKefPCny0IBFD/ia6LDzps9A=; b=hSaELUsLI5V54Eq3BEpviouach1ZQsWQP5TzrR5JVk4aWlYCQCbusBnP49pMZMXxcI 6xQi7p7gahZ0nq/JwK/Jtc6U+WRhvqlUhbrBxIObopK1eShhl1ErEUaPM/9vhru8X2CZ 9xBUui5Vn1g7s+qi/Go4UAS1cbmkAS/6+O+LsvtGGj90nvDJ4G1U6ILFEUx0SLRMscmq rtUmXpeglDJH/B3nnA2ANbr6i4MlJX0OljxlvLYdMuxyiQzW0IOD91XzKhEd8tk0dXC7 tHVwNREutPVfv996yY/bSWAj+Zy9FYFhvBiKZepwmPvLVjStxboV65A8ft8X4EcxG08j tsdQ==
MIME-Version 1.0
Date Wed, 7 Nov 2012 11:36:20 +0100
Subject how-to use readline.set_completion_display_matches_hook()?
From Jean-Pierre Miceli <j-p@sunrise.ch>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-Gm-Message-State ALoCoQk5sQIH5D/NvwXYnamt3fZJIDH9BHD80iQK0mmeaRAIpsOcOVrScjG1e1vuwQ5s7HSUBfJwx+CBIlArsBSH9cIzkJw4TnMcAv+u8Kv5tYH9vL1E96JUrahY27wEJImFOoGK2WceXesfLwUdSEhclDsC7mU7Vg==
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3364.1352286909.27098.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1352286909 news.xs4all.nl 6970 [2001:888:2000:d::a6]:51704
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32882

Show key headers only | View raw


Hi all,

I'm working on a tool which enable support of tab completion using the
readline modul.
And I have a problem with set_completion_display_matches_hook function

I've created a display hook function and registered it. It is called
and it prints the desire messages. But once it has completed,
readline/python does not display the prompt.
I've got to press the 'return' key to see the prompt again.
What should the display hook function do to return correctly and let
the prompt be displayed?

Example:
def completerHook(self, substitution, matches, longest_match_length):
    print ""
    print "Test of the display hook function"
    for i in range(len(matches)):
      print matches[i],

I use Python 2.7.3 and done some tests on Mac OS 10.7 (Lion) and
Ubuntu. I got the same issue on both system.

Thanks for your help
J-P

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

how-to use readline.set_completion_display_matches_hook()? Jean-Pierre Miceli <j-p@sunrise.ch> - 2012-11-07 11:36 +0100

csiph-web