Re: how to disable keys?

Urs Janßen <[email protected]> Mon, 22 Jun 2009 20:14:14 +0200
Newsgroups gmane.network.tin.devel,gmane.network.tin.user
Message-ID <[email protected]>
On Mon, Jun 22, 2009 at 06:50:53PM +0200, clemens fischer wrote:
> (please excuse if this posting shows up twice)
> 
> Hi,
> 
> I'm using a number of ncurses programs and often hit "[" or "]" by
> mistake.  As I don't need the "QuickFilterSelect" and "QuickFilterKill"
> functions, I want to disable them.  The same goes for "PageTopThd" and
> "PageBotThd" and a few others.  In addition to this, I want to remap
> a few bindings, which doesn't seem to really work.  It seems generic
> keybindings cannot be overridden or deleted.
> 
> Now my "~/.tin/keymap" reads (without the top lines):
> 
>   QuickFilterSelect NULL NULL
>   QuickFilterKill NULL NULL
>   PageTopThd NULL NULL
>   PageBotThd NULL NULL
>   ScrollUp <
>   ScrollDown >
>   Down j >
>   Up k <
>   PageUp b
>   PageDown SPACE
>   PageNextThd TAB
> 
> No error is flagged on startup and the "<", ">" keys work, but there
> seems to be no way to disable any keys, setting them to "NULL" doesn't
> work.  The source indicates any string starting with "N"* should do it.
> Especially with the Quick* functions this gets nasty, because tin
> doesn't give feedback about the new scores.
> 
> So what's wrong there?

logic prevents the same key (NULL) to be assigned to different functions.
first match (function; the order in the keymap file is not important, but the
order in which the functions are parsed in the code) counts. if the key is
already assigned to a diffrent function the laster function gets it's
default key added.

the following untedted pathc may work - or break remapping in total.

--- keymap.c.o  2009-06-22 20:10:14.000000000 +0200
+++ keymap.c    2009-06-22 20:10:22.000000000 +0200
@@ -155,7 +155,7 @@
 	struct keynode *entry = NULL;
 
 	/* is a function already associated with this key */
-	for (i = 0; i < keys->used; i++) {
+	for (i = 0; key != '\0' && i < keys->used; i++) {
 		if (keys->list[i].key == key)
 			entry = &keys->list[i];
 	}


urs
-- 
"Only whimps use tape backup: _real_ men just upload their important stuff
 on ftp, and let the rest of the world mirror it ;)" - Linus