[PATCH] Early keymap initialisation
Michael Bienia <[email protected]>
| Newsgroups | gmane.network.tin.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello, attached is a patch to the following TODO entry: ,---- | o before the keymapfile is read wait_for_input() might call prompt_yn() | to confirm a read-abort, but as the keys are not yet assigned you | can not leave the loop anymore. | [20050406 Urs Janssen <[email protected]>] `---- Michael
patch-20050413.diff
(text/plain, 3.3 KB)
doc/TODO | 5 -----
include/keymap.h | 1 +
src/keymap.c | 21 ++++-----------------
src/main.c | 1 +
4 files changed, 6 insertions(+), 22 deletions(-)
diff -Nurp tin-1.7.9/doc/TODO tin-1.7.9.new/doc/TODO
--- tin-1.7.9/doc/TODO 2005-04-08 14:03:38.000000000 +0200
+++ tin-1.7.9.new/doc/TODO 2005-04-10 18:02:09.321687379 +0200
@@ -13,11 +13,6 @@ o the decription in the online 'h'elp f
| <CR> read chosen group
[20050311 Urs Janssen <[email protected]>]
-o before the keymapfile is read wait_for_input() might call prompt_yn()
- to confirm a read-abort, but as the keys are not yet assigned you
- can not leave the loop anymore.
- [20050406 Urs Janssen <[email protected]>]
-
o can 'V'iew mime-parts with (illegal) encoded filename, e.g:
| Content-Type: image/jpeg;
| name="=?iso-8859-1?Q?internationales_Zeichen_f=FCr_Ehe.jpg?="
diff -Nurp tin-1.7.9/include/keymap.h tin-1.7.9.new/include/keymap.h
--- tin-1.7.9/include/keymap.h 2005-03-16 13:36:07.000000000 +0100
+++ tin-1.7.9.new/include/keymap.h 2005-04-10 15:46:46.917553860 +0200
@@ -407,4 +407,5 @@ extern t_function global_mouse_action(
t_function (*left_action) (void),
t_function (*right_action) (void));
extern t_function prompt_slk_response(t_function default_func, struct keylist keys, const char *fmt, ...);
+extern void setup_default_keys(void);
#endif /* !KEYMAP_H */
diff -Nurp tin-1.7.9/src/keymap.c tin-1.7.9.new/src/keymap.c
--- tin-1.7.9/src/keymap.c 2005-04-08 20:12:23.164718804 +0200
+++ tin-1.7.9.new/src/keymap.c 2005-04-10 15:53:26.581565852 +0200
@@ -51,9 +51,7 @@ static void add_default_key(struct keyli
static void add_global_keys(struct keylist *keys);
static void free_keylist(struct keylist *keys);
static void upgrade_keymap_file(char *old);
-static void setup_default_keys(void);
static t_bool add_key(struct keylist *keys, char key, t_function func, t_bool overwrite);
-static t_bool process_keymap_file(void);
static t_bool process_keys(t_function func, const char *keys, struct keylist *kl);
static t_bool process_mapping(char *keyname, char *keys);
@@ -255,6 +253,7 @@ printascii(
}
+#define KEYSEPS " \t\n"
/*
* read the keymap file
* returns TRUE if the keymap file was read without an error else FALSE
@@ -263,20 +262,6 @@ t_bool
read_keymap_file(
void)
{
- t_bool ret;
-
- ret = process_keymap_file();
- setup_default_keys();
-
- return ret;
-}
-
-
-#define KEYSEPS " \t\n"
-t_bool
-process_keymap_file(
- void)
-{
FILE *fp = (FILE *) 0;
char *line, *keydef, *kname;
char *map, *ptr;
@@ -336,6 +321,7 @@ process_keymap_file(
}
}
+ free_keymaps();
while ((line = fgets(buf, sizeof(buf), fp)) != NULL) {
/*
* Ignore blank and comment lines
@@ -369,6 +355,7 @@ process_keymap_file(
}
fclose(fp);
+ setup_default_keys();
if (upgrade != RC_IGNORE)
upgrade_prompt_quit(upgrade, map);
@@ -2147,7 +2134,7 @@ upgrade_keymap_file(
/*
* add the default key bindings for still free keys
*/
-static void
+void
setup_default_keys(
void)
{
diff -Nurp tin-1.7.9/src/main.c tin-1.7.9.new/src/main.c
--- tin-1.7.9/src/main.c 2005-03-12 01:52:57.000000000 +0100
+++ tin-1.7.9.new/src/main.c 2005-04-10 15:59:14.879753307 +0200
@@ -129,6 +129,7 @@ main(
hash_init();
init_selfinfo();
init_group_hash();
+ setup_default_keys();
/*
* Read user local & global config files