Add support for returnOpts without clearing the screen
modified: src/libnms.c
This commit is contained in:
parent
e7ec1e9b9a
commit
4d7706c907
27
src/libnms.c
27
src/libnms.c
@ -377,24 +377,31 @@ char nms_exec(char *string) {
|
|||||||
// Flush any input up to this point
|
// Flush any input up to this point
|
||||||
nms_clear_input();
|
nms_clear_input();
|
||||||
|
|
||||||
if (clearScr) {
|
// Check if user must select from a set of options
|
||||||
|
if (returnOpts != NULL && strlen(returnOpts) > 0) {
|
||||||
|
|
||||||
// Position cursor
|
// Position cursor if necessary
|
||||||
if (inputPositionY >= 0 && inputPositionX >= 0) {
|
if (inputPositionY >= 0 && inputPositionX >= 0) {
|
||||||
CURSOR_MOVE(inputPositionY, inputPositionX);
|
CURSOR_MOVE(inputPositionY, inputPositionX);
|
||||||
|
}
|
||||||
|
|
||||||
CURSOR_SHOW();
|
CURSOR_SHOW();
|
||||||
}
|
|
||||||
|
|
||||||
// User must press a key to continue
|
// Get and validate user selection
|
||||||
ret = nms_get_char();
|
while (strchr(returnOpts, ret = nms_get_char()) == NULL) {
|
||||||
if (returnOpts != NULL && strlen(returnOpts) > 0) {
|
|
||||||
while (strchr(returnOpts, ret) == NULL) {
|
|
||||||
BEEP();
|
BEEP();
|
||||||
ret = nms_get_char();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore screen and cursor
|
}
|
||||||
|
|
||||||
|
// User must press a key to continue when clearSrc is set
|
||||||
|
// without returnOpts
|
||||||
|
else if (clearScr) {
|
||||||
|
nms_get_char();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore screen and cursor is clearSrc is set
|
||||||
|
if (clearScr) {
|
||||||
SCREEN_RESTORE();
|
SCREEN_RESTORE();
|
||||||
CURSOR_SHOW();
|
CURSOR_SHOW();
|
||||||
CURSOR_RESTORE();
|
CURSOR_RESTORE();
|
||||||
|
Loading…
Reference in New Issue
Block a user