if (prefix(buf, "***** "))
{
/* Notice "menu" requests */
- if ((buf[6] == '[') && (isdigit(buf[7]) || isalpha(buf[7])))
+ if ((buf[6] == '[') && isalpha(buf[7]))
{
/* This is a menu file */
menu = TRUE;
/* Extract the menu item */
- k = isdigit(buf[7]) ? D2I(buf[7]) : buf[7] - 'A' + 10;
+ k = buf[7] - 'A';
if ((buf[8] == ']') && (buf[9] == ' '))
{
Term_clear();
/* Restart when necessary */
- if (line >= size) line = 0;
-
+ if (line >= size - rows) line = size - rows;
+ if (line < 0) line = 0;
/* Re-open the file if needed */
if (next > line)
caption, line, size), 0, 0);
}
- /* Prompt -- menu screen */
- if (menu)
- {
- /* Wait for it */
-#ifdef JP
-prt("[ ÈÖ¹æ¤òÆþÎϤ·¤Æ²¼¤µ¤¤( ESC¤Ç½ªÎ» ) ]", hgt - 1, 0);
-#else
- prt("[Press a Number, or ESC to exit.]", hgt - 1, 0);
-#endif
-
- }
-
/* Prompt -- small files */
- else if (size <= rows)
+ if (size <= rows)
{
/* Wait for it */
#ifdef JP
}
}
- /* Hack -- Allow backing up */
+ /* Allow backing up */
if (k == '-')
{
line = line + (reverse ? rows : -rows);
- if (line < 0) line = ((size-1)/rows)*rows;
+ if (line < 0) line = 0;
}
- /* Hack -- Advance a single line */
- if ((k == '\n') || (k == '\r'))
+ /* Advance a single line */
+ if ((k == '\n') || (k == '\r') || (k == '2'))
{
line = line + (reverse ? -1 : 1);
- if (line < 0) line = ((size-1)/rows)*rows;
+ if (line < 0) line = 0;
+ }
+
+ /* Advance a single line back */
+ if (k == '8')
+ {
+ line = line + (reverse ? 1 : -1);
+ if (line < 0) line = 0;
}
/* Advance one page */
{
int key = -1;
- if (isdigit(k)) key = D2I(k);
- else if (isalpha(k)) key = k - 'A' + 10;
+ if (isalpha(k))
+ key = k - 'A';
if ((key > -1) && hook[key][0])
{