annotate srogue/mdport.c @ 98:ea71ef31d9be

srogue: fix backspace key. Once the full mdport.c is added to srogue, erasechar() will be replaced with md_erasechar().
author John "Elwin" Edwards
date Wed, 28 Aug 2013 18:54:35 -0700
parents 8757a0593e6e
children 8d1dfc5a912c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
86
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
1 /*
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
2 mdport.c - Machine Dependent Code
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
3
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
4 Copyright (C) 2005-2008 Nicholas J. Kisseberth
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
5 All rights reserved.
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
6
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
7 Redistribution and use in source and binary forms, with or without
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
8 modification, are permitted provided that the following conditions
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
9 are met:
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
10 1. Redistributions of source code must retain the above copyright
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
11 notice, this list of conditions and the following disclaimer.
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
12 2. Redistributions in binary form must reproduce the above copyright
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
13 notice, this list of conditions and the following disclaimer in the
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
14 documentation and/or other materials provided with the distribution.
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
15 3. Neither the name(s) of the author(s) nor the names of other contributors
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
16 may be used to endorse or promote products derived from this software
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
17 without specific prior written permission.
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
18
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
19 THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
22 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
23 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
24 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
25 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
26 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
27 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
28 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
29 SUCH DAMAGE.
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
30 */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
31
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
32 /* This is a temporary stub version of rogue5's mdport.c. It is only to make
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
33 * md_readchar() available until srogue is ported to autoconf. Then the
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
34 * whole file should work.
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
35 */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
36
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
37 #include <stdlib.h>
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
38 #include <string.h>
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
39
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
40 #if defined(_WIN32)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
41 #include <Windows.h>
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
42 #include <Lmcons.h>
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
43 #include <io.h>
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
44 #include <conio.h>
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
45 #pragma warning( disable: 4201 )
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
46 #include <shlobj.h>
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
47 #pragma warning( default: 4201 )
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
48 #include <Shlwapi.h>
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
49 #undef MOUSE_MOVED
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
50 #endif
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
51
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
52 #include <sys/types.h>
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
53
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
54 #include <curses.h> /* AIX requires curses.h be included before term.h */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
55
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
56 #include <ctype.h>
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
57 #include "rogue.h"
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
58
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
59 /*
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
60 Cursor/Keypad Support
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
61
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
62 Sadly Cursor/Keypad support is less straightforward than it should be.
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
63
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
64 The various terminal emulators/consoles choose to differentiate the
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
65 cursor and keypad keys (with modifiers) in different ways (if at all!).
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
66 Furthermore they use different code set sequences for each key only
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
67 a subset of which the various curses libraries recognize. Partly due
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
68 to incomplete termcap/terminfo entries and partly due to inherent
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
69 limitations of those terminal capability databases.
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
70
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
71 I give curses first crack at decoding the sequences. If it fails to decode
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
72 it we check for common ESC-prefixed sequences.
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
73
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
74 All cursor/keypad results are translated into standard rogue movement
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
75 commands.
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
76
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
77 Unmodified keys are translated to walk commands: hjklyubn
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
78 Modified (shift,control,alt) are translated to run commands: HJKLYUBN
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
79
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
80 Console and supported (differentiated) keys
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
81 Interix: Cursor Keys, Keypad, Ctl-Keypad
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
82 Cygwin: Cursor Keys, Keypad, Alt-Cursor Keys
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
83 MSYS: Cursor Keys, Keypad, Ctl-Cursor Keys, Ctl-Keypad
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
84 Win32: Cursor Keys, Keypad, Ctl/Shift/Alt-Cursor Keys, Ctl/Alt-Keypad
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
85 DJGPP: Cursor Keys, Keypad, Ctl/Shift/Alt-Cursor Keys, Ctl/Alt-Keypad
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
86
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
87 Interix Console (raw, ncurses)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
88 ==============================
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
89 normal shift ctrl alt
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
90 ESC [D, ESC F^, ESC [D, ESC [D /# Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
91 ESC [C, ESC F$, ESC [C, ESC [C /# Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
92 ESC [A, ESC F-, local win, ESC [A /# Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
93 ESC [B, ESC F+, local win, ESC [B /# Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
94 ESC [H, ESC [H, ESC [H, ESC [H /# Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
95 ESC [S, local win, ESC [S, ESC [S /# Page Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
96 ESC [T, local win, ESC [T, ESC [T /# Page Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
97 ESC [U, ESC [U, ESC [U, ESC [U /# End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
98 ESC [D, ESC F^, ESC [D, O /# Keypad Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
99 ESC [C, ESC F$, ESC [C, O /# Keypad Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
100 ESC [A, ESC [A, ESC [-1, O /# Keypad Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
101 ESC [B, ESC [B, ESC [-2, O /# Keypad Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
102 ESC [H, ESC [H, ESC [-263, O /# Keypad Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
103 ESC [S, ESC [S, ESC [-19, O /# Keypad PgUp #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
104 ESC [T, ESC [T, ESC [-20, O /# Keypad PgDn #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
105 ESC [U, ESC [U, ESC [-21, O /# Keypad End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
106 nothing, nothing, nothing, O /# Kaypad 5 #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
107
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
108 Interix Console (term=interix, ncurses)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
109 ==============================
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
110 KEY_LEFT, ESC F^, KEY_LEFT, KEY_LEFT /# Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
111 KEY_RIGHT, ESC F$, KEY_RIGHT, KEY_RIGHT /# Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
112 KEY_UP, 0x146, local win, KEY_UP /# Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
113 KEY_DOWN, 0x145, local win, KEY_DOWN /# Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
114 ESC [H, ESC [H, ESC [H, ESC [H /# Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
115 KEY_PPAGE, local win, KEY_PPAGE, KEY_PPAGE /# Page Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
116 KEY_NPAGE, local win, KEY_NPAGE, KEY_NPAGE /# Page Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
117 KEY_LL, KEY_LL, KEY_LL, KEY_LL /# End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
118 KEY_LEFT, ESC F^, ESC [-4, O /# Keypad Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
119 KEY_RIGHT, ESC F$, ESC [-3, O /# Keypad Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
120 KEY_UP, KEY_UP, ESC [-1, O /# Keypad Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
121 KEY_DOWN, KEY_DOWN, ESC [-2, O /# Keypad Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
122 ESC [H, ESC [H, ESC [-263, O /# Keypad Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
123 KEY_PPAGE, KEY_PPAGE, ESC [-19, O /# Keypad PgUp #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
124 KEY_NPAGE, KEY_NPAGE, ESC [-20, O /# Keypad PgDn #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
125 KEY_LL, KEY_LL, ESC [-21, O /# Keypad End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
126 nothing, nothing, nothing, O /# Keypad 5 #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
127
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
128 Cygwin Console (raw, ncurses)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
129 ==============================
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
130 normal shift ctrl alt
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
131 ESC [D, ESC [D, ESC [D, ESC ESC [D /# Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
132 ESC [C, ESC [C, ESC [C, ESC ESC [C /# Rght #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
133 ESC [A, ESC [A, ESC [A, ESC ESC [A /# Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
134 ESC [B, ESC [B, ESC [B, ESC ESC [B /# Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
135 ESC [1~, ESC [1~, ESC [1~, ESC ESC [1~ /# Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
136 ESC [5~, ESC [5~, ESC [5~, ESC ESC [5~ /# Page Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
137 ESC [6~, ESC [6~, ESC [6~, ESC ESC [6~ /# Page Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
138 ESC [4~, ESC [4~, ESC [4~, ESC ESC [4~ /# End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
139 ESC [D, ESC [D, ESC [D, ESC ESC [D,O /# Keypad Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
140 ESC [C, ESC [C, ESC [C, ESC ESC [C,O /# Keypad Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
141 ESC [A, ESC [A, ESC [A, ESC ESC [A,O /# Keypad Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
142 ESC [B, ESC [B, ESC [B, ESC ESC [B,O /# Keypad Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
143 ESC [1~, ESC [1~, ESC [1~, ESC ESC [1~,O /# Keypad Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
144 ESC [5~, ESC [5~, ESC [5~, ESC ESC [5~,O /# Keypad PgUp #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
145 ESC [6~, ESC [6~, ESC [6~, ESC ESC [6~,O /# Keypad PgDn #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
146 ESC [4~, ESC [4~, ESC [4~, ESC ESC [4~,O /# Keypad End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
147 ESC [-71, nothing, nothing, O /# Keypad 5 #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
148
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
149 Cygwin Console (term=cygwin, ncurses)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
150 ==============================
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
151 KEY_LEFT, KEY_LEFT, KEY_LEFT, ESC-260 /# Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
152 KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, ESC-261 /# Rght #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
153 KEY_UP, KEY_UP, KEY_UP, ESC-259 /# Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
154 KEY_DOWN, KEY_DOWN, KEY_DOWN, ESC-258 /# Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
155 KEY_HOME, KEY_HOME, KEY_HOME, ESC-262 /# Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
156 KEY_PPAGE, KEY_PPAGE, KEY_PPAGE, ESC-339 /# Page Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
157 KEY_NPAGE, KEY_NPAGE, KEY_NPAGE, ESC-338 /# Page Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
158 KEY_END, KEY_END, KEY_END, ESC-360 /# End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
159 KEY_LEFT, KEY_LEFT, KEY_LEFT, ESC-260,O /# Keypad Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
160 KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, ESC-261,O /# Keypad Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
161 KEY_UP, KEY_UP, KEY_UP, ESC-259,O /# Keypad Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
162 KEY_DOWN, KEY_DOWN, KEY_DOWN, ESC-258,O /# Keypad Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
163 KEY_HOME, KEY_HOME, KEY_HOME, ESC-262,O /# Keypad Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
164 KEY_PPAGE, KEY_PPAGE, KEY_PPAGE, ESC-339,O /# Keypad PgUp #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
165 KEY_NPAGE, KEY_NPAGE, KEY_NPAGE, ESC-338,O /# Keypad PgDn #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
166 KEY_END, KEY_END, KEY_END, ESC-360,O /# Keypad End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
167 ESC [G, nothing, nothing, O /# Keypad 5 #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
168
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
169 MSYS Console (raw, ncurses)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
170 ==============================
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
171 normal shift ctrl alt
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
172 ESC OD, ESC [d, ESC Od nothing /# Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
173 ESC OE, ESC [e, ESC Oe, nothing /# Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
174 ESC OA, ESC [a, ESC Oa, nothing /# Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
175 ESC OB, ESC [b, ESC Ob, nothing /# Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
176 ESC [7~, ESC [7$, ESC [7^, nothing /# Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
177 ESC [5~, local window, ESC [5^, nothing /# Page Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
178 ESC [6~, local window, ESC [6^, nothing /# Page Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
179 ESC [8~, ESC [8$, ESC [8^, nothing /# End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
180 ESC OD, ESC [d, ESC Od O /# Keypad Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
181 ESC OE, ESC [c, ESC Oc, O /# Keypad Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
182 ESC OA, ESC [a, ESC Oa, O /# Keypad Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
183 ESC OB, ESC [b, ESC Ob, O /# Keypad Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
184 ESC [7~, ESC [7$, ESC [7^, O /# Keypad Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
185 ESC [5~, local window, ESC [5^, O /# Keypad PgUp #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
186 ESC [6~, local window, ESC [6^, O /# Keypad PgDn #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
187 ESC [8~, ESC [8$, ESC [8^, O /# Keypad End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
188 11, 11, 11, O /# Keypad 5 #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
189
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
190 MSYS Console (term=rxvt, ncurses)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
191 ==============================
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
192 normal shift ctrl alt
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
193 KEY_LEFT, KEY_SLEFT, 514 nothing /# Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
194 KEY_RIGHT, KEY_SRIGHT, 516, nothing /# Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
195 KEY_UP, 518, 519, nothing /# Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
196 KEY_DOWN, 511, 512, nothing /# Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
197 KEY_HOME, KEY_SHOME, ESC [7^, nothing /# Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
198 KEY_PPAGE, local window, ESC [5^, nothing /# Page Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
199 KEY_NPAGE, local window, ESC [6^, nothing /# Page Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
200 KEY_END, KEY_SEND, KEY_EOL, nothing /# End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
201 KEY_LEFT, KEY_SLEFT, 514 O /# Keypad Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
202 KEY_RIGHT, KEY_SRIGHT, 516, O /# Keypad Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
203 KEY_UP, 518, 519, O /# Keypad Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
204 KEY_DOWN, 511, 512, O /# Keypad Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
205 KEY_HOME, KEY_SHOME, ESC [7^, O /# Keypad Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
206 KEY_PPAGE, local window, ESC [5^, O /# Keypad PgUp #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
207 KEY_NPAGE, local window, ESC [6^, O /# Keypad PgDn #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
208 KEY_END, KEY_SEND, KEY_EOL, O /# Keypad End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
209 11, 11, 11, O /# Keypad 5 #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
210
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
211 Win32 Console (raw, pdcurses)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
212 DJGPP Console (raw, pdcurses)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
213 ==============================
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
214 normal shift ctrl alt
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
215 260, 391, 443, 493 /# Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
216 261, 400, 444, 492 /# Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
217 259, 547, 480, 490 /# Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
218 258, 548, 481, 491 /# Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
219 262, 388, 447, 524 /# Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
220 339, 396, 445, 526 /# Page Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
221 338, 394, 446, 520 /# Page Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
222 358, 384, 448, 518 /# End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
223 452, 52('4'), 511, 521 /# Keypad Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
224 454, 54('6'), 513, 523 /# Keypad Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
225 450, 56('8'), 515, 525 /# Keypad Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
226 456, 50('2'), 509, 519 /# Keypad Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
227 449, 55('7'), 514, 524 /# Keypad Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
228 451, 57('9'), 516, 526 /# Keypad PgUp #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
229 457, 51('3'), 510, 520 /# Keypad PgDn #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
230 455, 49('1'), 508, 518 /# Keypad End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
231 453, 53('5'), 512, 522 /# Keypad 5 #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
232
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
233 Win32 Console (pdcurses, MSVC/MingW32)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
234 DJGPP Console (pdcurses)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
235 ==============================
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
236 normal shift ctrl alt
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
237 KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT /# Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
238 KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT /# Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
239 KEY_UP, KEY_SUP, CTL_UP, ALT_UP /# Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
240 KEY_DOWN, KEY_SDOWN, CTL_DOWN, ALT_DOWN /# Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
241 KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME /# Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
242 KEY_PPAGE, KEY_SPREVIOUS, CTL_PGUP, ALT_PGUP /# Page Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
243 KEY_NPAGE, KEY_SNEXTE, CTL_PGDN, ALT_PGDN /# Page Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
244 KEY_END, KEY_SEND, CTL_END, ALT_END /# End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
245 KEY_B1, 52('4'), CTL_PAD4, ALT_PAD4 /# Keypad Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
246 KEY_B3, 54('6'), CTL_PAD6, ALT_PAD6 /# Keypad Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
247 KEY_A2, 56('8'), CTL_PAD8, ALT_PAD8 /# Keypad Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
248 KEY_C2, 50('2'), CTL_PAD2, ALT_PAD2 /# Keypad Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
249 KEY_A1, 55('7'), CTL_PAD7, ALT_PAD7 /# Keypad Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
250 KEY_A3, 57('9'), CTL_PAD9, ALT_PAD9 /# Keypad PgUp #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
251 KEY_C3, 51('3'), CTL_PAD3, ALT_PAD3 /# Keypad PgDn #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
252 KEY_C1, 49('1'), CTL_PAD1, ALT_PAD1 /# Keypad End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
253 KEY_B2, 53('5'), CTL_PAD5, ALT_PAD5 /# Keypad 5 #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
254
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
255 Windows Telnet (raw)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
256 ==============================
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
257 normal shift ctrl alt
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
258 ESC [D, ESC [D, ESC [D, ESC [D /# Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
259 ESC [C, ESC [C, ESC [C, ESC [C /# Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
260 ESC [A, ESC [A, ESC [A, ESC [A /# Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
261 ESC [B, ESC [B, ESC [B, ESC [B /# Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
262 ESC [1~, ESC [1~, ESC [1~, ESC [1~ /# Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
263 ESC [5~, ESC [5~, ESC [5~, ESC [5~ /# Page Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
264 ESC [6~, ESC [6~, ESC [6~, ESC [6~ /# Page Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
265 ESC [4~, ESC [4~, ESC [4~, ESC [4~ /# End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
266 ESC [D, ESC [D, ESC [D, ESC [D /# Keypad Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
267 ESC [C, ESC [C, ESC [C, ESC [C /# Keypad Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
268 ESC [A, ESC [A, ESC [A, ESC [A /# Keypad Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
269 ESC [B, ESC [B, ESC [B, ESC [B /# Keypad Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
270 ESC [1~, ESC [1~, ESC [1~, ESC [1~ /# Keypad Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
271 ESC [5~, ESC [5~, ESC [5~, ESC [5~ /# Keypad PgUp #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
272 ESC [6~, ESC [6~, ESC [6~, ESC [6~ /# Keypad PgDn #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
273 ESC [4~, ESC [4~, ESC [4~, ESC [4~ /# Keypad End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
274 nothing, nothing, nothing, nothing /# Keypad 5 #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
275
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
276 Windows Telnet (term=xterm)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
277 ==============================
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
278 normal shift ctrl alt
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
279 KEY_LEFT, KEY_LEFT, KEY_LEFT, KEY_LEFT /# Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
280 KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT /# Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
281 KEY_UP, KEY_UP, KEY_UP, KEY_UP /# Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
282 KEY_DOWN, KEY_DOWN, KEY_DOWN, KEY_DOWN /# Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
283 ESC [1~, ESC [1~, ESC [1~, ESC [1~ /# Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
284 KEY_PPAGE, KEY_PPAGE, KEY_PPAGE, KEY_PPAGE /# Page Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
285 KEY_NPAGE, KEY_NPAGE, KEY_NPAGE, KEY_NPAGE /# Page Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
286 ESC [4~, ESC [4~, ESC [4~, ESC [4~ /# End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
287 KEY_LEFT, KEY_LEFT, KEY_LEFT, O /# Keypad Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
288 KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, O /# Keypad Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
289 KEY_UP, KEY_UP, KEY_UP, O /# Keypad Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
290 KEY_DOWN, KEY_DOWN, KEY_DOWN, O /# Keypad Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
291 ESC [1~, ESC [1~, ESC [1~, ESC [1~ /# Keypad Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
292 KEY_PPAGE, KEY_PPAGE, KEY_PPAGE, KEY_PPAGE /# Keypad PgUp #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
293 KEY_NPAGE, KEY_NPAGE, KEY_NPAGE, KEY_NPAGE /# Keypad PgDn #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
294 ESC [4~, ESC [4~, ESC [4~, O /# Keypad End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
295 ESC [-71, nothing, nothing, O /# Keypad 5 #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
296
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
297 PuTTY
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
298 ==============================
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
299 normal shift ctrl alt
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
300 ESC [D, ESC [D, ESC OD, ESC [D /# Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
301 ESC [C, ESC [C, ESC OC, ESC [C /# Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
302 ESC [A, ESC [A, ESC OA, ESC [A /# Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
303 ESC [B, ESC [B, ESC OB, ESC [B /# Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
304 ESC [1~, ESC [1~, local win, ESC [1~ /# Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
305 ESC [5~, local win, local win, ESC [5~ /# Page Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
306 ESC [6~, local win, local win, ESC [6~ /# Page Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
307 ESC [4~, ESC [4~, local win, ESC [4~ /# End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
308 ESC [D, ESC [D, ESC [D, O /# Keypad Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
309 ESC [C, ESC [C, ESC [C, O /# Keypad Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
310 ESC [A, ESC [A, ESC [A, O /# Keypad Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
311 ESC [B, ESC [B, ESC [B, O /# Keypad Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
312 ESC [1~, ESC [1~, ESC [1~, O /# Keypad Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
313 ESC [5~, ESC [5~, ESC [5~, O /# Keypad PgUp #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
314 ESC [6~, ESC [6~, ESC [6~, O /# Keypad PgDn #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
315 ESC [4~, ESC [4~, ESC [4~, O /# Keypad End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
316 nothing, nothing, nothing, O /# Keypad 5 #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
317
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
318 PuTTY
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
319 ==============================
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
320 normal shift ctrl alt
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
321 KEY_LEFT, KEY_LEFT, ESC OD, ESC KEY_LEFT /# Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
322 KEY_RIGHT KEY_RIGHT, ESC OC, ESC KEY_RIGHT /# Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
323 KEY_UP, KEY_UP, ESC OA, ESC KEY_UP /# Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
324 KEY_DOWN, KEY_DOWN, ESC OB, ESC KEY_DOWN /# Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
325 ESC [1~, ESC [1~, local win, ESC ESC [1~ /# Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
326 KEY_PPAGE local win, local win, ESC KEY_PPAGE /# Page Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
327 KEY_NPAGE local win, local win, ESC KEY_NPAGE /# Page Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
328 ESC [4~, ESC [4~, local win, ESC ESC [4~ /# End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
329 ESC Ot, ESC Ot, ESC Ot, O /# Keypad Left #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
330 ESC Ov, ESC Ov, ESC Ov, O /# Keypad Right #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
331 ESC Ox, ESC Ox, ESC Ox, O /# Keypad Up #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
332 ESC Or, ESC Or, ESC Or, O /# Keypad Down #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
333 ESC Ow, ESC Ow, ESC Ow, O /# Keypad Home #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
334 ESC Oy, ESC Oy, ESC Oy, O /# Keypad PgUp #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
335 ESC Os, ESC Os, ESC Os, O /# Keypad PgDn #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
336 ESC Oq, ESC Oq, ESC Oq, O /# Keypad End #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
337 ESC Ou, ESC Ou, ESC Ou, O /# Keypad 5 #/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
338 */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
339
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
340 #define M_NORMAL 0
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
341 #define M_ESC 1
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
342 #define M_KEYPAD 2
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
343 #define M_TRAIL 3
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
344
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
345 int undo[5];
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
346 int uindex = -1;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
347
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
348 int
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
349 reread()
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
350 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
351 int redo;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
352
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
353 if (uindex < 0)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
354 return 0;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
355
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
356 redo = undo[0];
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
357 undo[0] = undo[1];
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
358 undo[1] = undo[2];
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
359 undo[2] = undo[3];
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
360 undo[3] = undo[4];
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
361 uindex--;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
362 return redo;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
363 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
364
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
365 void
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
366 unread(int c)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
367 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
368 if (uindex >= 4)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
369 abort();
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
370
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
371 undo[++uindex] = c;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
372 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
373
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
374 int
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
375 md_readchar(WINDOW *win)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
376 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
377 int ch = 0;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
378 int lastch = 0;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
379 int mode = M_NORMAL;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
380 int mode2 = M_NORMAL;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
381 int nodelayf = 0;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
382 int count = 0;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
383
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
384 for(;;)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
385 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
386 if (mode == M_NORMAL && uindex >= 0)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
387 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
388 ch = reread();
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
389 break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
390 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
391
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
392 ch = wgetch(win);
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
393
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
394 if (ch == ERR) /* timed out or error */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
395 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
396 if (nodelayf) /* likely timed out, switch to */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
397 { /* normal mode and block on */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
398 mode = M_NORMAL; /* next read */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
399 nodelayf = 0;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
400 nodelay(win,0);
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
401 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
402 else if (count > 10) /* after 10 errors assume */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
403 auto_save(0); /* input stream is broken and */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
404 else /* auto save and exit */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
405 count++;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
406
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
407 continue;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
408 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
409
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
410 count = 0; /* reset input error count */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
411
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
412 if (mode == M_TRAIL)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
413 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
414 if (ch == '^') /* msys console : 7,5,6,8: modified*/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
415 ch = CTRL( toupper(lastch) );
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
416 else if (ch == '~') /* cygwin console: 1,5,6,4: normal */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
417 ch = tolower(lastch); /* windows telnet: 1,5,6,4: normal */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
418 /* msys console : 7,5,6,8: normal */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
419 else if (mode2 == M_ESC) /* cygwin console: 1,5,6,4: modified*/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
420 ch = CTRL( toupper(ch) );
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
421 else
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
422 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
423 mode = M_NORMAL;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
424 unread(ch);
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
425 continue;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
426 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
427
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
428 break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
429 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
430
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
431 if (mode == M_ESC)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
432 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
433 if (ch == 27)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
434 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
435 mode2 = M_ESC;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
436 unread(ch);
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
437 continue;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
438 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
439
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
440 if ((ch == 'F') || (ch == 'O') || (ch == '['))
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
441 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
442 mode = M_KEYPAD;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
443 unread(ch);
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
444 continue;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
445 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
446
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
447
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
448 switch(ch)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
449 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
450 /* Cygwin Console */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
451 /* PuTTY */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
452 case KEY_LEFT : ch = CTRL('H'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
453 case KEY_RIGHT: ch = CTRL('L'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
454 case KEY_UP : ch = CTRL('K'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
455 case KEY_DOWN : ch = CTRL('J'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
456 case KEY_HOME : ch = CTRL('Y'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
457 case KEY_PPAGE: ch = CTRL('U'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
458 case KEY_NPAGE: ch = CTRL('N'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
459 case KEY_END : ch = CTRL('B'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
460
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
461 default: mode = M_NORMAL;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
462 mode2 = M_NORMAL;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
463 unread(ch);
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
464 continue;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
465 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
466
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
467 break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
468 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
469
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
470 if (mode == M_KEYPAD)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
471 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
472 switch(ch)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
473 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
474 /* ESC F - Interix Console codes */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
475 case '^': ch = CTRL('H'); break; /* Shift-Left */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
476 case '$': ch = CTRL('L'); break; /* Shift-Right */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
477
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
478 /* ESC [ - Interix Console codes */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
479 case 'H': ch = 'y'; break; /* Home */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
480 case 1: ch = CTRL('K'); break; /* Ctl-Keypad Up */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
481 case 2: ch = CTRL('J'); break; /* Ctl-Keypad Down */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
482 case 3: ch = CTRL('L'); break; /* Ctl-Keypad Right */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
483 case 4: ch = CTRL('H'); break; /* Ctl-Keypad Left */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
484 case 263: ch = CTRL('Y'); break; /* Ctl-Keypad Home */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
485 case 19: ch = CTRL('U'); break; /* Ctl-Keypad PgUp */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
486 case 20: ch = CTRL('N'); break; /* Ctl-Keypad PgDn */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
487 case 21: ch = CTRL('B'); break; /* Ctl-Keypad End */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
488
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
489 /* ESC [ - Cygwin Console codes */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
490 case 'G': ch = '.'; break; /* Keypad 5 */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
491 case '7': lastch = 'Y'; mode=M_TRAIL; break; /* Ctl-Home */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
492 case '5': lastch = 'U'; mode=M_TRAIL; break; /* Ctl-PgUp */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
493 case '6': lastch = 'N'; mode=M_TRAIL; break; /* Ctl-PgDn */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
494
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
495 /* ESC [ - Win32 Telnet, PuTTY */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
496 case '1': lastch = 'y'; mode=M_TRAIL; break; /* Home */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
497 case '4': lastch = 'b'; mode=M_TRAIL; break; /* End */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
498
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
499 /* ESC [ - not understood by screen/tmux */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
500 case 'E': ch = '.'; break; /* Keypad 5 */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
501
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
502 /* ESC O - PuTTY */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
503 case 'D': ch = CTRL('H'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
504 case 'C': ch = CTRL('L'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
505 case 'A': ch = CTRL('K'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
506 case 'B': ch = CTRL('J'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
507 case 't': ch = 'h'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
508 case 'v': ch = 'l'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
509 case 'x': ch = 'k'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
510 case 'r': ch = 'j'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
511 case 'w': ch = 'y'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
512 case 'y': ch = 'u'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
513 case 's': ch = 'n'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
514 case 'q': ch = 'b'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
515 case 'u': ch = '.'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
516 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
517
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
518 if (mode != M_KEYPAD)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
519 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
520 unread(ch);
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
521 continue;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
522 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
523 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
524
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
525 if (ch == 27)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
526 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
527 nodelay(win,1);
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
528 mode = M_ESC;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
529 nodelayf = 1;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
530 unread(ch);
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
531 continue;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
532 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
533
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
534 switch(ch)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
535 {
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
536 case KEY_LEFT : ch = 'h'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
537 case KEY_DOWN : ch = 'j'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
538 case KEY_UP : ch = 'k'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
539 case KEY_RIGHT : ch = 'l'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
540 case KEY_HOME : ch = 'y'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
541 case KEY_PPAGE : ch = 'u'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
542 case KEY_END : ch = 'b'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
543 #ifdef KEY_LL
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
544 case KEY_LL : ch = 'b'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
545 #endif
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
546 case KEY_NPAGE : ch = 'n'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
547 case KEY_BEG : ch = '.'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
548
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
549 #ifdef KEY_B1
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
550 case KEY_B1 : ch = 'h'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
551 case KEY_C2 : ch = 'j'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
552 case KEY_A2 : ch = 'k'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
553 case KEY_B3 : ch = 'l'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
554 #endif
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
555 case KEY_A1 : ch = 'y'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
556 case KEY_A3 : ch = 'u'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
557 case KEY_C1 : ch = 'b'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
558 case KEY_C3 : ch = 'n'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
559 case KEY_B2 : ch = '.'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
560
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
561 #ifdef KEY_SLEFT
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
562 case KEY_SRIGHT : ch = CTRL('L'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
563 case KEY_SLEFT : ch = CTRL('H'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
564 #ifdef KEY_SUP
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
565 case KEY_SUP : ch = CTRL('K'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
566 case KEY_SDOWN : ch = CTRL('J'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
567 #endif
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
568 case KEY_SHOME : ch = CTRL('Y'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
569 case KEY_SPREVIOUS:ch = CTRL('U'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
570 case KEY_SEND : ch = CTRL('B'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
571 case KEY_SNEXT : ch = CTRL('N'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
572 #endif
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
573 case 0x146 : ch = CTRL('K'); break; /* Shift-Up */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
574 case 0x145 : ch = CTRL('J'); break; /* Shift-Down */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
575
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
576
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
577 #ifdef CTL_RIGHT
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
578 case CTL_RIGHT : ch = CTRL('L'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
579 case CTL_LEFT : ch = CTRL('H'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
580 case CTL_UP : ch = CTRL('K'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
581 case CTL_DOWN : ch = CTRL('J'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
582 case CTL_HOME : ch = CTRL('Y'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
583 case CTL_PGUP : ch = CTRL('U'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
584 case CTL_END : ch = CTRL('B'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
585 case CTL_PGDN : ch = CTRL('N'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
586 #endif
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
587 #ifdef KEY_EOL
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
588 case KEY_EOL : ch = CTRL('B'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
589 #endif
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
590
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
591 #ifndef CTL_PAD1
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
592 /* MSYS rxvt console */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
593 case 511 : ch = CTRL('J'); break; /* Shift Dn */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
594 case 512 : ch = CTRL('J'); break; /* Ctl Down */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
595 case 514 : ch = CTRL('H'); break; /* Ctl Left */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
596 case 516 : ch = CTRL('L'); break; /* Ctl Right*/
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
597 case 518 : ch = CTRL('K'); break; /* Shift Up */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
598 case 519 : ch = CTRL('K'); break; /* Ctl Up */
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
599 #endif
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
600
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
601 #ifdef CTL_PAD1
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
602 case CTL_PAD1 : ch = CTRL('B'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
603 case CTL_PAD2 : ch = CTRL('J'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
604 case CTL_PAD3 : ch = CTRL('N'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
605 case CTL_PAD4 : ch = CTRL('H'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
606 case CTL_PAD5 : ch = '.'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
607 case CTL_PAD6 : ch = CTRL('L'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
608 case CTL_PAD7 : ch = CTRL('Y'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
609 case CTL_PAD8 : ch = CTRL('K'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
610 case CTL_PAD9 : ch = CTRL('U'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
611 #endif
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
612
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
613 #ifdef ALT_RIGHT
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
614 case ALT_RIGHT : ch = CTRL('L'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
615 case ALT_LEFT : ch = CTRL('H'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
616 case ALT_DOWN : ch = CTRL('J'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
617 case ALT_HOME : ch = CTRL('Y'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
618 case ALT_PGUP : ch = CTRL('U'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
619 case ALT_END : ch = CTRL('B'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
620 case ALT_PGDN : ch = CTRL('N'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
621 #endif
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
622
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
623 #ifdef ALT_PAD1
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
624 case ALT_PAD1 : ch = CTRL('B'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
625 case ALT_PAD2 : ch = CTRL('J'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
626 case ALT_PAD3 : ch = CTRL('N'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
627 case ALT_PAD4 : ch = CTRL('H'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
628 case ALT_PAD5 : ch = '.'; break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
629 case ALT_PAD6 : ch = CTRL('L'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
630 case ALT_PAD7 : ch = CTRL('Y'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
631 case ALT_PAD8 : ch = CTRL('K'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
632 case ALT_PAD9 : ch = CTRL('U'); break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
633 #endif
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
634 #ifdef KEY_BACKSPACE /* NCURSES in Keypad mode sends this for Ctrl-H */
98
ea71ef31d9be srogue: fix backspace key.
John "Elwin" Edwards
parents: 86
diff changeset
635 case KEY_BACKSPACE: ch = erasechar(); break;
86
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
636 #endif
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
637 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
638
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
639 break;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
640 }
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
641
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
642 if (nodelayf)
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
643 nodelay(win,0);
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
644
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
645 uindex = -1;
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
646
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
647 return(ch & 0x7F);
8757a0593e6e srogue: add arrow-key support.
John "Elwin" Edwards
parents:
diff changeset
648 }