cursesw+setlocale fixes it! (was: Re: Problem with curses and UTF-8)

2006-02-09 Thread Ian Ward
Damjan wrote: > import curses, locale > locale.setlocale(locale.LC_ALL, '') > s = curses.initscr() Hey, that works for me. Combined characters and wide characters are working too. Now the real problem.. how do I convince the python higher-ups to link against cursesw by default? At the very le

Re: Replacing curses (Was: Re: Problem with curses and UTF-8)

2006-02-09 Thread Joel Hedlund
> The code for handling window resizing isn't jumping out at > me but I'll keep looking. (...jumping out, rather unexpectedly!) You might be interested in an ongoing discussion that I and Grant Edwards are holding in this newsgroup on the subject "Best way of finding terminal width/height?".

Re: Replacing curses (Was: Re: Problem with curses and UTF-8)

2006-02-08 Thread Ian Ward
Jean-Paul Calderone wrote: >> I've looked at newt and snack, but all I really need is: >> - a way to position the cursor at (0,0) >> - a way to hide and show the cursor >> - a way to detect when the terminal is resized >> - a way to query the terminal size > > You might be interested in Twisted Co

Re: Problem with curses and UTF-8

2006-02-08 Thread Damjan
I just recompiled my python to link to ncursesw, and tried your example with a little modification: import curses, locale locale.setlocale(locale.LC_ALL, '') s = curses.initscr() s.addstr(u'\u00c5 U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE\n'.encode('utf-8') ) s.addstr(u'\u00f5 U+00F5 LATIN SMA

Re: Replacing curses (Was: Re: Problem with curses and UTF-8)

2006-02-08 Thread Jean-Paul Calderone
On Wed, 08 Feb 2006 15:10:26 -0500, Ian Ward <[EMAIL PROTECTED]> wrote: >Grant Edwards wrote: >> Depending on what you're tring to do, slang might be an option, > >I've looked at newt and snack, but all I really need is: >- a way to position the cursor at (0,0) >- a way to hide and show the cursor

Re: Problem with curses and UTF-8

2006-02-08 Thread Thomas Dickey
Ian Ward <[EMAIL PROTECTED]> wrote: > Martin v. Löwis wrote: >> If that was Python's configure: don't do that. Instead, hack setup.py >> to make it change the compiler/linker settings, or even edit the >> compiler/linker line manually at first. > Ok, that compiled. same here - though it was not

Re: Problem with curses and UTF-8

2006-02-08 Thread Thomas Dickey
"Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >> I'll test it if someone would dumb down "link with ncursesw instead of >> ncurses" a little for me. >> >> I tried: >> ./configure --with-libs="ncursesw5" >> >> and it failed saying: >> checking size of wchar_t... configure: error: cannot compute siz

Re: Problem with curses and UTF-8

2006-02-08 Thread Ian Ward
Martin v. Löwis wrote: > If that was Python's configure: don't do that. Instead, hack setup.py > to make it change the compiler/linker settings, or even edit the > compiler/linker line manually at first. Ok, that compiled. Now when I run the same test: import curses s = curses.initscr() s.addst

Re: Problem with curses and UTF-8

2006-02-08 Thread Martin v. Löwis
> I'll test it if someone would dumb down "link with ncursesw instead of > ncurses" a little for me. > > I tried: > ./configure --with-libs="ncursesw5" > > and it failed saying: > checking size of wchar_t... configure: error: cannot compute sizeof > (wchar_t), 77 If that was Python's configure:

Re: Replacing curses (Was: Re: Problem with curses and UTF-8)

2006-02-08 Thread Ian Ward
Grant Edwards wrote: > Depending on what you're tring to do, slang might be an option, I've looked at newt and snack, but all I really need is: - a way to position the cursor at (0,0) - a way to hide and show the cursor - a way to detect when the terminal is resized - a way to query the terminal s

Re: Problem with curses and UTF-8

2006-02-08 Thread Martin v. Löwis
Thomas Dickey wrote: > no need for debugging - it's a well-known problem. UTF-8 uses more than > one byte per cell, normal curses uses one byte per cell. To handle UTF-8, > you need ncursesw. I tried that, but it didn't improve anything. Regards, Martin -- http://mail.python.org/mailman/listin

Re: Problem with curses and UTF-8

2006-02-08 Thread Ian Ward
Thomas Dickey wrote: > "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >>The ncurses documentation suggests that you should link with >>ncurses_w instead of linking with ncurses - you might try >>that as well. If it helps, please do report back. > > > ncursesw I'll test it if someone would dumb dow

Re: Replacing curses (Was: Re: Problem with curses and UTF-8)

2006-02-08 Thread Grant Edwards
On 2006-02-08, Ian Ward <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> Why not use termcap/terminfo? > > That's a good idea, but I'd have to wrap the c library myself, > wouldn't I? Probably. I don't remember seeing a python module for them. > Also, what happens when a user has an incorrec

Re: Replacing curses (Was: Re: Problem with curses and UTF-8)

2006-02-08 Thread Ian Ward
Grant Edwards wrote: > Why not use termcap/terminfo? That's a good idea, but I'd have to wrap the c library myself, wouldn't I? Also, what happens when a user has an incorrect TERM setting (I've run into this before) I don't want to reimpliment all the nice speed optimizations that the curses

Re: Replacing curses (Was: Re: Problem with curses and UTF-8)

2006-02-08 Thread Grant Edwards
On 2006-02-08, Ian Ward <[EMAIL PROTECTED]> wrote: > I think there are enough escape sequences common to all modern terminals > so that I can build a generic curses-replacement for my library. Why not use termcap/terminfo? -- Grant Edwards grante Yow! Where does

Re: Problem with curses and UTF-8

2006-02-08 Thread Thomas Dickey
"Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > Ian Ward wrote: >> Any Ideas? > I think there is one or more ncurses bugs somewhere. indeed. It might be nice to report them rather than jawing about it. > The ncurses documentation suggests that you should link with > ncurses_w instead of linking

Replacing curses (Was: Re: Problem with curses and UTF-8)

2006-02-07 Thread Ian Ward
Martin v. Löwis wrote: >Ian Ward wrote: > > >>Any Ideas? >> >> > >I think there is one or more ncurses bugs somewhere. > >The ncurses documentation suggests that you should link with >ncurses_w instead of linking with ncurses - you might try >that as well. If it helps, please do report back.

Re: Problem with curses and UTF-8

2006-02-07 Thread Martin v. Löwis
Ian Ward wrote: > Any Ideas? I think there is one or more ncurses bugs somewhere. The ncurses documentation suggests that you should link with ncurses_w instead of linking with ncurses - you might try that as well. If it helps, please do report back. Ultimately, somebody will need to debug ncurs

Problem with curses and UTF-8

2006-02-07 Thread Ian Ward
When I run the following code in a terminal with the encoding set to UTF-8 I get garbage on the first line, but the correct output on the second. import curses s = curses.initscr() s.addstr('\xc3\x85 U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE\n') s.addstr('\xc3\xa5 U+00F5 LATIN SMALL LETTER O