blob: 581bdf6103ec9424fc3c117cefedc15d3b3553b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
$NetBSD: patch-al,v 1.1 2009/10/22 22:01:26 wiz Exp $
--- src/tcurses.c.orig 2008-12-30 20:26:25.000000000 +0100
+++ src/tcurses.c
@@ -896,72 +896,77 @@ get_arrow_key(
# ifdef NCURSES_MOUSE_VERSION
MEVENT my_event;
# endif /* NCURSES_MOUSE_VERSION */
- int ch = getch();
+ int ch;
int code = KEYMAP_UNKNOWN;
- switch (ch) {
- case KEY_DC:
- code = KEYMAP_DEL;
- break;
-
- case KEY_IC:
- code = KEYMAP_INS;
- break;
-
- case KEY_UP:
- code = KEYMAP_UP;
- break;
-
- case KEY_DOWN:
- code = KEYMAP_DOWN;
- break;
-
- case KEY_LEFT:
- code = KEYMAP_LEFT;
- break;
-
- case KEY_RIGHT:
- code = KEYMAP_RIGHT;
- break;
-
- case KEY_NPAGE:
- code = KEYMAP_PAGE_DOWN;
- break;
-
- case KEY_PPAGE:
- code = KEYMAP_PAGE_UP;
- break;
-
- case KEY_HOME:
- code = KEYMAP_HOME;
- break;
-
- case KEY_END:
- code = KEYMAP_END;
- break;
+ if (cmd_line)
+ code = cmd_get_arrow_key(prech);
+ else {
+ ch = getch();
+ switch (ch) {
+ case KEY_DC:
+ code = KEYMAP_DEL;
+ break;
+
+ case KEY_IC:
+ code = KEYMAP_INS;
+ break;
+
+ case KEY_UP:
+ code = KEYMAP_UP;
+ break;
+
+ case KEY_DOWN:
+ code = KEYMAP_DOWN;
+ break;
+
+ case KEY_LEFT:
+ code = KEYMAP_LEFT;
+ break;
+
+ case KEY_RIGHT:
+ code = KEYMAP_RIGHT;
+ break;
+
+ case KEY_NPAGE:
+ code = KEYMAP_PAGE_DOWN;
+ break;
+
+ case KEY_PPAGE:
+ code = KEYMAP_PAGE_UP;
+ break;
+
+ case KEY_HOME:
+ code = KEYMAP_HOME;
+ break;
+
+ case KEY_END:
+ code = KEYMAP_END;
+ break;
# ifdef NCURSES_MOUSE_VERSION
- case KEY_MOUSE:
- if (getmouse(&my_event) != ERR) {
- switch ((int) my_event.bstate) {
- case BUTTON1_CLICKED:
- xmouse = MOUSE_BUTTON_1;
- break;
-
- case BUTTON2_CLICKED:
- xmouse = MOUSE_BUTTON_2;
- break;
-
- case BUTTON3_CLICKED:
- xmouse = MOUSE_BUTTON_3;
- break;
+ case KEY_MOUSE:
+ if (getmouse(&my_event) != ERR) {
+ switch ((int) my_event.bstate) {
+ case BUTTON1_CLICKED:
+ xmouse = MOUSE_BUTTON_1;
+ break;
+
+ case BUTTON2_CLICKED:
+ xmouse = MOUSE_BUTTON_2;
+ break;
+
+ case BUTTON3_CLICKED:
+ xmouse = MOUSE_BUTTON_3;
+ break;
+ }
+ xcol = my_event.x; /* column */
+ xrow = my_event.y; /* row */
+ code = KEYMAP_MOUSE;
}
- xcol = my_event.x; /* column */
- xrow = my_event.y; /* row */
- code = KEYMAP_MOUSE;
- }
- break;
+ break;
# endif /* NCURSES_MOUSE_VERSION */
+ }
}
return code;
}
|