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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
--- src/tui.c.orig Sun Feb 11 20:28:53 2001
+++ src/tui.c Sun Jul 3 15:01:30 2005
@@ -302,8 +302,8 @@
/* Move cursor and update screen as needed
- * mode is one of CURSOR_UP, CURSOR_DOWN, CURSOR_PG_UP, CURSOR_PG_DOWN
- * or CURSOR_REDRAW
+ * mode is one of CURSOR_UP, CURSOR_DOWN, CURSOR_PG_UP, CURSOR_PG_DOWN,
+ * CURSOR_TOP, CURSOR_BOTTOM or CURSOR_REDRAW
*/
static void tui_move_cursor (struct TUI *tui, int mode)
@@ -360,6 +360,24 @@
refresh ();
}
break;
+
+ case CURSOR_TOP:
+ if (d->cursor > 0) {
+ mvaddch (d->cursor - d->base + 2, 1, ' ');
+ tui_upd_y (d, tui, -d->cursor, 0);
+ mvaddch (d->cursor - d->base + 2, 1, '*');
+ refresh ();
+ }
+ break;
+
+ case CURSOR_BOTTOM:
+ if (d->cursor < (d->items - 1)) {
+ mvaddch (d->cursor - d->base + 2, 1, ' ');
+ tui_upd_y (d, tui, d->items - d->cursor - 1, 0);
+ mvaddch (d->cursor - d->base + 2, 1, '*');
+ refresh ();
+ }
+ break;
case CURSOR_REDRAW:
if (d->items) {
@@ -382,22 +400,24 @@
{
static char help[] = {" (help)\n"
"\n"
- "I a add tune\n"
- " b page up\n"
+ " a add tune\n"
+ " ^B page up\n"
" c clear queue\n"
" d delete tune\n"
- " h help message\n"
- " i up\n"
- "I j left\n"
- " k down\n"
- "I l right\n"
+ " ^F page down\n"
+ " g go to top\n"
+ " G go to bottom\n"
+ " h left\n"
+ " j down\n"
+ " k up\n"
+ " l right\n"
" m move to top\n"
" p pause\n"
" q quit\n"
" r randomize\n"
" s skip tune\n"
" t toggle display\n"
- " sp page down\n"
+ " ? help message\n"
"\n"
" <press any key>"};
@@ -733,72 +753,68 @@
switch (key) {
case KEY_NPAGE:
+ case 0x06: /* ^F */
case ' ':
tui_move_cursor (tui, CURSOR_PG_DOWN);
break;
case 'a':
- case 'A':
tui_add_to_queue (tui);
break;
case KEY_PPAGE:
- case 'b':
- case 'B':
+ case 0x02: /* ^B */
tui_move_cursor (tui, CURSOR_PG_UP);
break;
case 'c':
- case 'C':
tui_clear_queue (tui);
break;
case 'd':
- case 'D':
tui_delete_from_queue (tui);
break;
-
- case 'h':
- case 'H':
- tui_help_screen (tui);
+
+ case KEY_HOME:
+ case 'g':
+ tui_move_cursor (tui, CURSOR_TOP);
break;
-
- case KEY_UP:
- case 'i':
- case 'I':
- tui_move_cursor (tui, CURSOR_UP);
+
+ case KEY_END:
+ case 'G':
+ tui_move_cursor (tui, CURSOR_BOTTOM);
break;
case KEY_LEFT:
- case 'j':
- case 'J':
+ case 'h':
tui_leave_dir (tui);
break;
case KEY_DOWN:
- case 'k':
- case 'K':
+ case 'j':
tui_move_cursor (tui, CURSOR_DOWN);
break;
+
+ case KEY_UP:
+ case 'k':
+ tui_move_cursor (tui, CURSOR_UP);
+ break;
+
case KEY_RIGHT:
case 'l':
- case 'L':
tui_enter_dir (tui);
break;
case 'm':
- case 'M':
tui_move_item (tui);
break;
case 'p':
- case 'P':
tui->player->cmd = PLAYER_PAUSE;
break;
case 'q':
- case 'Q':
tui_status_message (tui, "Quit? (y/n)");
exit = tui_yes_no ();
if (!exit) {
@@ -810,20 +826,21 @@
break;
case 'r':
- case 'R':
tui_randomize_queue (tui);
break;
case 's':
- case 'S':
tui->player->cmd = PLAYER_SKIP;
break;
case 't':
- case 'T':
tui->dm ^= 1;
tui_redraw_status (tui);
tui_move_cursor (tui, CURSOR_REDRAW);
+ break;
+
+ case '?':
+ tui_help_screen (tui);
}
} while (!exit);
}
--- src/tui.h.orig Sun Jun 27 15:16:20 1999
+++ src/tui.h Sun Jul 3 14:14:20 2005
@@ -16,7 +16,9 @@
#define CURSOR_DOWN 3
#define CURSOR_PG_UP 4
#define CURSOR_PG_DOWN 5
-#define CURSOR_REDRAW 6
+#define CURSOR_TOP 6
+#define CURSOR_BOTTOM 7
+#define CURSOR_REDRAW 8
struct TUI_DISP {
int items;
|