Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93303
| Path | csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!border2.nntp.ams1.giganews.com!nntp.giganews.com!bcyclone04.am1.xlned.com!bcyclone04.am1.xlned.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <cameron@cskk.homeip.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'configure': 0.04; 'bytes.': 0.07; 'clause': 0.07; 'subject:both': 0.07; 'subject:same': 0.07; 'issue?': 0.09; 'tab': 0.09; 'cc:addr :python-list': 0.10; 'python': 0.11; 'obviously': 0.15; '>on': 0.16; '\\n\\': 0.16; 'answers:': 0.16; 'backspace': 0.16; 'bindings.': 0.16; 'commented': 0.16; 'consulted': 0.16; 'emulator': 0.16; 'experiments': 0.16; 'file;': 0.16; 'frankly': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'old-style': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:cskk.homeip.net': 0.16; 'received:homeip.net': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'sequence.': 0.16; 'simpson': 0.16; 'threw': 0.16; 'using,': 0.16; 'wrote:': 0.16; 'config': 0.18; 'skip:i 40': 0.18; 'gui': 0.18; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; '(the': 0.22; 'am,': 0.23; 'code.': 0.23; 'decide': 0.23; '2015': 0.23; 'this:': 0.23; 'cheers,': 0.24; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'example': 0.25; 'header:User-Agent:1': 0.26; 'chris': 0.26; 'wonder': 0.27; 'defining': 0.27; 'issue,': 0.27; 'subject: -- ': 0.27; 'rest': 0.28; 'behaviour': 0.29; 'readline': 0.29; "we're": 0.30; 'subject:time': 0.31; 'anyone': 0.32; 'probably': 0.32; 'possibly': 0.32; 'problem': 0.33; "d'aprano": 0.33; 'done,': 0.33; 'received:com.au': 0.33; 'shift': 0.33; 'steven': 0.33; '(for': 0.34; 'definition': 0.34; 'subject:?': 0.34; 'this?': 0.34; 'previous': 0.34; 'could': 0.35; 'next': 0.35; 'configured': 0.35; 'there': 0.36; '(and': 0.36; 'subject:: ': 0.37; 'charset :us-ascii': 0.37; 'instead': 0.38; 'stuff': 0.38; 'express': 0.38; 'end': 0.39; 'expect': 0.39; 'system.': 0.39; 'subject:-': 0.39; 'subject:the': 0.40; 'yes': 0.60; 'content-disposition:inline': 0.60; 'your': 0.60; 'back': 0.61; "you'll": 0.61; 'per': 0.61; 'leading': 0.62; 'different': 0.64; 'cameron': 0.66; 'hour': 0.69; '3.6': 0.84; '4:55': 0.84; 'distinguish': 0.84; 'fire!': 0.84; 'replicate': 0.84; 'want:': 0.84 |
| Date | Tue, 30 Jun 2015 10:25:05 +1000 |
| From | Cameron Simpson <cs@zip.com.au> |
| To | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Subject | Re: Readline -- cannot bind to both Ctrl-tab and tab at the same time? |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii; format=flowed |
| Content-Disposition | inline |
| In-Reply-To | <CAPTjJmrHW6zyOqQYutjZNdq_7X5r+fZzSiFqJKJW9J7oas+cPQ@mail.gmail.com> |
| User-Agent | Mutt/1.5.23 (2014-03-12) |
| References | <CAPTjJmrHW6zyOqQYutjZNdq_7X5r+fZzSiFqJKJW9J7oas+cPQ@mail.gmail.com> |
| X-Optus-CM-Score | 0 |
| X-Optus-CM-Analysis | v=2.1 cv=ItbjC+Lg c=1 sm=1 tr=0 a=rgDbx50tNA2z7xLXQOoruw==:117 a=rgDbx50tNA2z7xLXQOoruw==:17 a=ZtCCktOnAAAA:8 a=PO7r1zJSAAAA:8 a=vrnE16BAAAAA:8 a=yEdEr6MRgwAA:10 a=kj9zAlcOel0A:10 a=XAFQembCKUMA:10 a=pGLkceISAAAA:8 a=kZ7UWmmPAAAA:8 a=uPZiAMpXAAAA:8 a=FC8VUaWo9L2TS08yamcA:9 a=CjuIK1q_8ugA:10 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.176.1435623926.3674.python-list@python.org> (permalink) |
| Lines | 83 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1435623926 news.xs4all.nl 2944 [2001:888:2000:d::a6]:51473 |
| X-Complaints-To | abuse@xs4all.nl |
| X-Received-Bytes | 8147 |
| X-Received-Body-CRC | 1206137745 |
| Xref | csiph.com comp.lang.python:93303 |
Show key headers only | View raw
On 29Jun2015 11:36, Chris Angelico <rosuav@gmail.com> wrote:
>On Mon, Jun 29, 2015 at 4:55 AM, Steven D'Aprano <steve@pearwood.info> wrote:
>> Try Ctrl-TAB again, and you'll get "raise" instead of "import".
>>
>> Can anyone else replicate this issue?
>>
>> Is this a Python issue, a problem with the terminal I am using, or readline
>> in general?
>
>Confirmed with Python 3.6 on Debian Jessie. Delving into Laura's
>suggestion that it's a readline problem, I came across this:
>
>http://stackoverflow.com/questions/12044574/getting-complete-and-menu-complete-to-work-together
>
>Testing with "showkey -a" suggests that tab and ctrl-tab indeed send
>the same bytes. I wonder if there's a way to change terminal type or
>fiddle with terminfo to change this? GUI programs obviously don't have
>this conflation.
Yes, this was my surmise (and expectation, frankly - what did you expect
ctrl-TAB to send?) So there is no way for the program in the terminal to
distinguish one from the other; you will always only get one of your bindings.
I would not expect terminfo to get you anything on its own - it is consulted by
the receiving program. The sending program (the terminal emulator) needs to be
configured to send different sequences for TAB and ctrl-TAB. Once that is done,
_then_ you may be able to augument your terminfo to express this behaviour and
have readline honour the change.
1: Work backward from the readline internals to find out if it consults a
terminfo property to find out what ctrl-TAB might be.
2: Decide on what you want ctrl-TAB to send instead of the TAB code.
3: Make a new terminfo clause defining that (for readline's use) and hooking
onto your old terminfo definition for the rest (tc=other_terminal in termcap,
possibly the same in terminfo).
4: Configure your terminal emulator to send that sequence.
Regarding 4, with proper old-style X11 terminals you could control all this
directly with the VT100.Translations properties. Example from my xterm
Xdefaults file; the leading F1 definition is probably what you want:
XTerm*.VT100.Translations: #override \n\
<KeyPress>F1 : string(0x1b) \n \
<KeyPress>F10 : secure() \n \
<KeyPress>KP_End : scroll-forw(100,page) \n \
<KeyPress>KP_Prior : scroll-back(1,halfpage) \n \
<KeyPress>KP_Next : scroll-forw(1,halfpage) \n\
<KeyPress>End : scroll-forw(100,page) \n \
Ctrl<KeyPress>Up : scroll-back(1,line) \n \
Ctrl<KeyPress>Down : scroll-forw(1,line) \n\
<KeyPress>Prior : scroll-back(1,halfpage) \n \
<KeyPress>Next : scroll-forw(1,halfpage) \n\
Meta<KeyPress> : string(0x1b) insert() \n\
Alt<KeyPress> : string(0x1b) insert() \n\
<KeyPress>BackSpace : string(0x08) \n \
Shift<Btn1Down> : ignore() \n\
Shift<Btn1Up> : insert-selection(PRIMARY,CUT_BUFFER0)\n\
<Btn2Down> : ignore() \n\
<Btn2Up> : insert-selection(PRIMARY,CUT_BUFFER0)\n\
Shift<Btn2Down> : ignore() \n\
Shift<Btn2Up> : string("us ") insert-selection(PRIMARY,CUT_BUFFER0)
string("\n") \n\
~Ctrl ~Meta<Btn3Down> : ignore()\n\
~Ctrl ~Meta<Btn3Up> : ignore()\n
! commented out, previous experiments
! XTerm*VT100.translations: #override Shift<Key>'F1':insert("hi guys")
! XTerm*VT100.translations: #override
Ctrl<Key>'U':uphalfscreen()\nCtrl<Key>'D'downhalfscreen()
The new fangled terminals like gnome-terminal or Konsole probably threw that
stuff out as they threw out all the other normal X11 config hooks, and
doubtless use their own arcane system. Enjoy.
Cheers,
Cameron Simpson <cs@zip.com.au>
The top three answers: Yes I *am* going to a fire!
Oh! We're using *kilometers* per hour now.
I have to go that fast to get back to my own time.
- Peter Harper <bo165@FreeNet.Carleton.CA>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Readline -- cannot bind to both Ctrl-tab and tab at the same time? Cameron Simpson <cs@zip.com.au> - 2015-06-30 10:25 +1000
csiph-web