Prevent spaces from being interpreted as accelerators.

This commit is contained in:
jkh 1999-12-14 04:18:22 +00:00
parent 92bdda92f4
commit 796518d068
3 changed files with 16 additions and 7 deletions

View File

@ -18,8 +18,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef lint
static const char rcsid[] = "$FreeBSD$";
#endif
#include <dialog.h>
#include "dialog.priv.h"
@ -251,9 +255,9 @@ dialog_checklist(unsigned char *title, unsigned char *prompt, int height, int wi
/* Check if key pressed matches first character of any item tag in list */
for (i = 0; i < max_choice; i++)
if (key < 0x100 && toupper(key) == toupper(items[(scroll+i)*3][0]))
if (isprint(key) && key < 0x100 && toupper(key) == toupper(items[(scroll+i)*3][0]))
break;
if (i < max_choice || (key >= '1' && key <= MIN('9', '0'+max_choice)) ||
KEY_IS_UP(key) || KEY_IS_DOWN(key) || key == ' ') {

View File

@ -20,6 +20,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef lint
static const char rcsid[] = "$FreeBSD$";
#endif
#include <dialog.h>
#include "dialog.priv.h"
@ -229,10 +232,10 @@ dialog_menu(unsigned char *title, unsigned char *prompt, int height, int width,
}
/* Check if key pressed matches first character of any item tag in menu */
for (i = 0; i < max_choice; i++)
if (key < 0x100 && toupper(key) == toupper(items[(scroll + i) * 2][0]))
for (i = 0; i < max_choice; i++)
if (key < 0x100 && isprint(key) && toupper(key) == toupper(items[(scroll + i) * 2][0]))
break;
if (i < max_choice || (key >= '1' && key <= MIN('9', '0'+max_choice)) || KEY_IS_UP(key) || KEY_IS_DOWN(key)) {
if (key >= '1' && key <= MIN('9', '0'+max_choice))
i = key - '1';

View File

@ -21,6 +21,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef lint
static const char rcsid[] = "$FreeBSD$";
#endif
#include <dialog.h>
#include "dialog.priv.h"
@ -262,9 +265,8 @@ dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, int wi
/* Check if key pressed matches first character of any item tag in list */
for (i = 0; i < max_choice; i++)
if (toupper(key) == toupper(items[(scroll + i) * 3][0]))
if (isprint(key) && toupper(key) == toupper(items[(scroll + i) * 3][0]))
break;
if (i < max_choice || (key >= '1' && key <= MIN('9', '0' + max_choice)) ||
KEY_IS_UP(key) || KEY_IS_DOWN(key) || key == ' ') {
if (key >= '1' && key <= MIN('9', '0' + max_choice))