Re: [tin 1.7.x] 'unbinding' keys
Urs Janßen <[email protected]>
| Newsgroups | gmane.network.tin.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Jul 01, 2005 at 07:27:12PM +0200, Michael Bienia wrote:
> For the second problem I might have an idea but I haven't tested yet if
> it is working: to disable a function we could assign a key,
> which can't be pressed, to this function. This would prevent that a
> default key is assigned to this function and therefore disabling it.
> Looking at the table at the beginning of keymap.h, there aren't much
> possiblities for such a key. Perhaps '\0' is working.
the following implements your idea and seems to work. better names
than "NULL" for the key?
--- keymap.c 2005-07-01 19:53:08.767015801 +0200
+++ keymap.c 2005-07-01 19:55:44.240294137 +0200
@@ -236,7 +236,9 @@
char *buf,
int ch)
{
- if ((ch == 0) || isgraph(ch)) { /* Regular printables */
+ if (ch == 0)
+ strcpy(buf, _("NULL"));
+ else if (isgraph(ch)) { /* Regular printables */
buf[0] = ch;
buf[1] = '\0';
} else if (ch == '\t') { /* TAB */
@@ -397,6 +399,10 @@
*/
if (strlen(keydef) > 1) {
switch (keydef[0]) {
+ case 'N':
+ key = '\0';
+ break;
+
case 'S': /* Only test 1st char - crude but effective */
key = ' ';
break;
--- help.c 2005-06-28 10:31:21.000000000 +0200
+++ help.c 2005-07-01 20:03:46.877125668 +0200
@@ -475,7 +475,7 @@
fprintf(fp, "%s", buf);
} else {
for (i = 0; i < keys.used; i++) {
- if (keys.list[i].function == helppage->func) {
+ if (keys.list[i].function == helppage->func && keys.list[i].key) {
buf = my_realloc(buf, LEN);
snprintf(buf, LEN, "%s\t %s", printascii(key, keys.list[i].key), _(helppage->helptext));
buf[LEN - 1] = '\0';