From fc4b6e4a93dc91fea7b64e9230d8aea9bcfe99ee Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Sat, 1 Jun 2002 16:50:16 +0000 Subject: [w3m-dev 03200] Re: New configuration option ``keymap_file'' and new command ``DEFINE_KEY'' * fm.h: add , unistd.h> * fm.h (keymap_file): added * func.c (keymap_initialized): added (current_keymap_file): added (setKeymap): added (initKeymap): rewrite to use setKeymap() * funcname.tab (DEFINE_KEY): added * main.c (MAIN): initKeymap(TRUE) (defKey): added * proto.h (defKey): added (setKeymap): added (initKeymap): add force param * rc.c (CMT_KEYMAP_FILE): added (params3): add keymap_file (sync_with_option): add initKeymap(FALSE) * doc/README.func (DEFINE_KEY): added * doc-jp/README.func: (DEFINE_KEY): added * scripts/w3mhelp.cgi.in: add defKey * NEWS: func: DEFINE_KEY rc: keymap_file From: Kiyokazu SUTO --- main.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 8c39ca4..5a48704 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.99 2002/04/26 16:06:34 ukai Exp $ */ +/* $Id: main.c,v 1.100 2002/06/01 16:50:16 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include @@ -724,7 +724,7 @@ MAIN(int argc, char **argv, char **envp) if (w3m_backend) backend(); if (!w3m_dump) { - initKeymap(); + initKeymap(TRUE); #ifdef USE_MENU initMenu(); #endif /* MENU */ @@ -5091,3 +5091,21 @@ setAlarmEvent(int sec, short status, int cmd, void *data) } } #endif + +void +defKey(void) +{ + char *data; + + CurrentKeyData = NULL; /* not allowed in w3m-control: */ + data = searchKeyData(); + if (data == NULL || *data == '\0') { + data = inputStrHist("Key definition: ", "", TextHist); + if (data == NULL || *data == '\0') { + displayBuffer(Currentbuf, B_NORMAL); + return; + } + } + setKeymap(allocStr(data, -1), -1, TRUE); + displayBuffer(Currentbuf, B_NORMAL); +} -- cgit v1.2.3