vms Meta key hack (trunk only)
I can't figure out how to make PuTTY use the Alt key to function as a Meta key and set a character's high bit, so I used this hack to test the M-5 fix just committed. This lets me specify a character to be used to force the next character to have its high bit set, so I can fake the Meta key with a two character sequence. (I used the back-tick/accent, since nethack doesn't do anything special with it.) Conceivably something like this should be promoted to the core; this just affects VMS, and only when vmstty.c is compiled with DEBUG defined.
This commit is contained in:
+30
-1
@@ -1,5 +1,4 @@
|
|||||||
/* NetHack 3.5 vmstty.c $Date$ $Revision$ */
|
/* NetHack 3.5 vmstty.c $Date$ $Revision$ */
|
||||||
/* SCCS Id: @(#)vmstty.c 3.5 2007/01/31 */
|
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
/* tty.c - (VMS) version */
|
/* tty.c - (VMS) version */
|
||||||
@@ -103,6 +102,36 @@ static unsigned long tt_char_restore = 0, tt_char_active = 0,
|
|||||||
tt2_char_restore = 0, tt2_char_active = 0;
|
tt2_char_restore = 0, tt2_char_active = 0;
|
||||||
static unsigned long ctrl_mask = 0;
|
static unsigned long ctrl_mask = 0;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
extern int NDECL(nh_vms_getchar);
|
||||||
|
|
||||||
|
/* rename the real vms_getchar and interpose this one in front of it */
|
||||||
|
int
|
||||||
|
vms_getchar()
|
||||||
|
{
|
||||||
|
static int althack = 0, altprefix;
|
||||||
|
char *nhalthack;
|
||||||
|
int res;
|
||||||
|
|
||||||
|
if (!althack) {
|
||||||
|
/* one-time init */
|
||||||
|
nhalthack = nh_getenv("NH_ALTHACK");
|
||||||
|
althack = nhalthack ? 1 : -1;
|
||||||
|
if (althack > 0)
|
||||||
|
altprefix = *nhalthack;
|
||||||
|
}
|
||||||
|
|
||||||
|
# define vms_getchar nh_vms_getchar
|
||||||
|
|
||||||
|
res = vms_getchar();
|
||||||
|
if (althack > 0 && res == altprefix) {
|
||||||
|
res = vms_getchar();
|
||||||
|
if (res != ESC) res = META(res);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
int
|
int
|
||||||
vms_getchar()
|
vms_getchar()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user