Add key rebinding
This is a modified version of Jason Dorje Short's key rebinding patch, and allows also binding special keys, such as the ones used in getloc and getpos. One of the ways to play NetHack on nethack.alt.org is via a HTML terminal in browser. Unfortunately this means several ctrl-key combinations cannot be entered, because the browser intercepts those. Similar thing applies to some international keyboard layouts on Windows. With this patch, the user can just rebind the command to a key that works best for them. I've tested this on Linux TTY, X11, and Windows TTY and GUI.
This commit is contained in:
18
src/pager.c
18
src/pager.c
@@ -1371,6 +1371,7 @@ whatdoes_help()
|
||||
destroy_nhwindow(tmpwin);
|
||||
}
|
||||
|
||||
#if 0
|
||||
#define WD_STACKLIMIT 5
|
||||
struct wd_stack_frame {
|
||||
Bitfield(active, 1);
|
||||
@@ -1501,18 +1502,31 @@ int *depth, lnum;
|
||||
}
|
||||
return stack[*depth].active ? TRUE : FALSE;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
char *
|
||||
dowhatdoes_core(q, cbuf)
|
||||
char q;
|
||||
char *cbuf;
|
||||
{
|
||||
dlb *fp;
|
||||
char buf[BUFSZ];
|
||||
#if 0
|
||||
dlb *fp;
|
||||
struct wd_stack_frame stack[WD_STACKLIMIT];
|
||||
boolean cond;
|
||||
int ctrl, meta, depth = 0, lnum = 0;
|
||||
#endif /* 0 */
|
||||
const char *ec_desc;
|
||||
|
||||
if ((ec_desc = key2extcmddesc(q)) != NULL) {
|
||||
char keybuf[QBUFSZ];
|
||||
|
||||
Sprintf(buf, "%-8s%s.", key2txt(q, keybuf), ec_desc);
|
||||
Strcpy(cbuf, buf);
|
||||
return cbuf;
|
||||
}
|
||||
return 0;
|
||||
#if 0
|
||||
fp = dlb_fopen(CMDHELPFILE, "r");
|
||||
if (!fp) {
|
||||
pline("Cannot open \"%s\" data file!", CMDHELPFILE);
|
||||
@@ -1568,6 +1582,7 @@ char *cbuf;
|
||||
if (depth != 0)
|
||||
impossible("cmdhelp: mismatched &? &: &. conditionals.");
|
||||
return (char *) 0;
|
||||
#endif /* 0 */
|
||||
}
|
||||
|
||||
int
|
||||
@@ -1718,6 +1733,7 @@ static struct {
|
||||
{ hmenu_dowhatdoes, "Info on what a given key does." },
|
||||
{ option_help, "List of game options." },
|
||||
{ dispfile_optionfile, "Longer explanation of game options." },
|
||||
{ dokeylist, "Full list of keyboard commands" },
|
||||
{ hmenu_doextlist, "List of extended commands." },
|
||||
{ dispfile_license, "The NetHack license." },
|
||||
{ docontact, "Support information." },
|
||||
|
||||
Reference in New Issue
Block a user