--with-ncurses problems
Pavel Roskin
proski at gnu.org
Mon Aug 27 21:20:00 UTC 2001
Hi, FrИdИric!
All my recent messages to you have bounced. On the other hand, you are
losing my e-mail address from CC: all the time. If the software does it
for you, consider using a better mail program. If you do it by hand, then
you are probably wrong. I don't like private discussions, but I would not
mind getting a personal copy of messages that are meant for me.
> Changes using --with-included-slang:
>
> End, Page Up, Page Down, Delete, Insert: Recognized with
> 'Learn keys'. But they work using --with-ncurses. The only
> problem is that they aren't recognized by 'Learn keys'. Why,
> if they work ?
I could reproduce this problem now.
I know why! Because learn_key() in src/key.c uses xgetch(), which is not
the same for ncurses and S-Lang. For S-Lang it's a low-level function,
that returns for every byte in the input. In ncurses it's a more
complicated function, that gets the whole sequence and returns the
interpreted code, KEY_IC in the case of Insert.
But then learn_store_key() casts the key code to char, and this gives "K".
I'm changing learn_keys so that the keypad mode is turned off when xgetch
is called.
---------------------------------
--- key.c
+++ key.c
@@ -870,10 +870,12 @@ char *learn_key (void)
fd_set Read_FD_Set;
struct timeval endtime;
struct timeval timeout;
- int c = xgetch ();
+ int c;
char buffer [256];
char *p = buffer;
+ keypad(stdscr, FALSE); /* disable intepreting keys by ncurses */
+ c = xgetch ();
while (c == ERR)
c = xgetch (); /* Sanity check, should be unnecessary */
learn_store_key (buffer, &p, c);
@@ -904,8 +906,9 @@ char *learn_key (void)
}
if (c == ERR)
break;
- learn_store_key (buffer, &p, c);
+ learn_store_key (buffer, &p, c);
}
+ keypad(stdscr, TRUE);
#ifdef BUGGY_CURSES
notimeout (stdscr, TRUE);
#else
---------------------------------
> Another problem. Under screen you don't need -c if compiled
> with --with-ncurses. If compiled with --with-included-slang
> colors aren't displayed without -c.
Not enabling the color by default is a limitation of S-Lang support in MC.
Missing support for "-c" with ncurses is a limitation of ncurses support
in MC. Fixes are possible and welcome, but nobody was annoyed enough to
make them.
> I tested on Linux console with TERM=linux . F19 and F20
> aren't recognized but +, -, and * are.
That's not surprizing. F19 and F20 are assigned to Shift-F7 and Shift-F8
is some linux keymaps. Those keymaps map Shift-Fn to F(n+12) to
distinguish between F12 and Shift-F2, but Shift-F9 and Shift-F10 become
unmapped. Try "loadkeys defkeymap_V1.0" for a keymap that supports
Shift-F9 and Shift-F10. Screen really can do nothing in the host terminal
(linux) doesn't provide the keys.
On the other hand, srceen interpretes keypad + according to the terminal
settings so that the programs have a unified "screen" terminal.
--
Regards,
Pavel Roskin
More information about the mc-devel
mailing list