bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Snow Leopard Cursor Keys broken.


From: Thomas Dickey
Subject: Re: Snow Leopard Cursor Keys broken.
Date: Sat, 10 Apr 2010 21:04:12 -0400 (EDT)

On Thu, 8 Apr 2010, Nicholas Cole wrote:

On Thu, Apr 8, 2010 at 6:28 PM, Nicholas Cole <address@hidden> wrote:
Dear List,

I'm having a strange curses problem on Mac OS 10.6.3.  If I use the
system provided python, curses applications do not correctly interpret
arrow keys (I've tried both with xterm and with Terminal.app, so I
don't think it is a terminal problem).  If I use the version of python
I've installed from fink, everything works as expected.

This is definitely a 10.6.3 problem.  When I found the problem on my
Desktop machine, I tested 10.6.2 on my laptop and it worked fine.
Upgrading to 10.6.3 broke the cursor keys in exactly the same way.

I've attached code that demonstrates the problem.  On 10.6.2 the left
arrow key produces "KEY_LEFT".  On 10.6.3 it produces "D"


What I'm seeing, with current code of course (I'm not sure what's in OSX 10.6.3 - given a patchdate for ncurses, I could make a better guess):

KEY_UP, ^C,  259
259
KEY_RIGHT, ^E,  261
261
KEY_DOWN, ^B,  258
258
KEY_LEFT, ^D,  260
260

The script you've sent uses keyname for the first part, which is the only
one that _could_ produce "KEY_LEFT".

The string from unctrl is explained by noting that the values are modulo 256.

While I was filling out a bug report to Apple, I realised I had sent
the wrong test code to this list.  My apologies.  Here is something
that will illustrate it without requiring non-standard libraries!

#!/usr/bin/python
import curses
import curses.ascii

def mainloop(scr):
   while 1:
       scr.keypad(1)
       curses.halfdelay(100)
       ch = scr.getch()
       if ch == "-1": scr.addstr(2, 0, '-1')
       try:
           scr.erase()
           scr.addstr(0,0, "%s, %s,  %s" %
           (curses.keyname(ch), curses.ascii.unctrl(ch), ch))
           scr.addstr(1,0, str(ch))
       except:
           pass
       scr.refresh()

if __name__ == "__main__":
#   locale.setlocale(locale.LC_ALL, '')
   print curses.wrapper(mainloop)


_______________________________________________
Bug-ncurses mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-ncurses


--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net

reply via email to

[Prev in Thread] Current Thread [Next in Thread]