aboutsummaryrefslogtreecommitdiffstats
path: root/com32/cmenu
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-08-28 22:21:00 -0700
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-09-01 11:43:38 -0700
commitf5a66e7b9f19b8781037da3bd2cf3a615f6c5096 (patch)
treeae0936b9f4b11af04d1b3a4e71cc85b7c0b08f56 /com32/cmenu
parent2d8107cf054e83ebd7bb045e01ea0755ad65fa20 (diff)
downloadsyslinux-f5a66e7b9f19b8781037da3bd2cf3a615f6c5096.tar.gz
syslinux-f5a66e7b9f19b8781037da3bd2cf3a615f6c5096.tar.xz
syslinux-f5a66e7b9f19b8781037da3bd2cf3a615f6c5096.zip
cmenu: refactor printmenuitem function
Simplify the printmenuitem function, now that putch is smarter.
Diffstat (limited to 'com32/cmenu')
-rw-r--r--com32/cmenu/libmenu/menu.c55
1 files changed, 17 insertions, 38 deletions
diff --git a/com32/cmenu/libmenu/menu.c b/com32/cmenu/libmenu/menu.c
index 4abc7b5a..eff05c45 100644
--- a/com32/cmenu/libmenu/menu.c
+++ b/com32/cmenu/libmenu/menu.c
@@ -87,45 +87,24 @@ char getch(char *scan)
/* attr[0] is non-hilite attr, attr[1] is highlight attr */
void printmenuitem(const char *str, uchar * attr)
{
- uchar page = getdisppage();
- uchar row, col;
- int hlite = NOHLITE; // Initially no highlighting
-
- getpos(&row, &col, page);
- while (*str) {
- switch (*str) {
- case '\b':
- --col;
- break;
- case '\n':
- ++row;
- break;
- case '\r':
- col = 0;
- break;
- case BELL: // No Bell Char
- break;
- case ENABLEHLITE: // Switch on highlighting
- hlite = HLITE;
- break;
- case DISABLEHLITE: // Turn off highlighting
- hlite = NOHLITE;
- break;
- default:
- putch(*str, attr[hlite], page);
- ++col;
- }
- if (col > getnumcols()) {
- ++row;
- col = 0;
- }
- if (row > getnumrows()) {
- scrollup();
- row = getnumrows();
+ uchar page = getdisppage();
+ int hlite = NOHLITE; // Initially no highlighting
+
+ while (*str) {
+ switch (*str) {
+ case BELL: // No Bell Char
+ break;
+ case ENABLEHLITE: // Switch on highlighting
+ hlite = HLITE;
+ break;
+ case DISABLEHLITE: // Turn off highlighting
+ hlite = NOHLITE;
+ break;
+ default:
+ putch(*str, attr[hlite], page);
+ }
+ str++;
}
- gotoxy(row, col, page);
- str++;
- }
}
int find_shortcut(pt_menu menu, uchar shortcut, int index)