ccmake: Correctly display edit mode and associated keys
Specific widgets can implement `PrintKeys` but their effects were hidden by the main widget `PrintKeys`. Fix this to give the user a better hint about the edit mode status. Closes: #13757
This commit is contained in:
parent
a9562eac3e
commit
5ca4abb27f
@ -347,14 +347,8 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
|
|||||||
cw = reinterpret_cast<cmCursesWidget*>(field_userptr(currentField));
|
cw = reinterpret_cast<cmCursesWidget*>(field_userptr(currentField));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cw) {
|
char fmt_s[] = "%s";
|
||||||
cw->PrintKeys();
|
if (cw == CM_NULLPTR || !cw->PrintKeys()) {
|
||||||
}
|
|
||||||
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
char firstLine[512] = "";
|
char firstLine[512] = "";
|
||||||
char secondLine[512] = "";
|
char secondLine[512] = "";
|
||||||
char thirdLine[512] = "";
|
char thirdLine[512] = "";
|
||||||
@ -383,8 +377,8 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
|
|||||||
}
|
}
|
||||||
|
|
||||||
curses_move(y - 4, 0);
|
curses_move(y - 4, 0);
|
||||||
char fmt_s[] = "%s";
|
char fmt[512] =
|
||||||
char fmt[512] = "Press [enter] to edit option Press [d] to delete an entry";
|
"Press [enter] to edit option Press [d] to delete an entry";
|
||||||
if (process) {
|
if (process) {
|
||||||
strcpy(fmt, " ");
|
strcpy(fmt, " ");
|
||||||
}
|
}
|
||||||
@ -395,13 +389,14 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
|
|||||||
printw(fmt_s, secondLine);
|
printw(fmt_s, secondLine);
|
||||||
curses_move(y - 1, 0);
|
curses_move(y - 1, 0);
|
||||||
printw(fmt_s, thirdLine);
|
printw(fmt_s, thirdLine);
|
||||||
|
}
|
||||||
|
|
||||||
if (cw) {
|
if (cw) {
|
||||||
sprintf(firstLine, "Page %d of %d", cw->GetPage(), this->NumberOfPages);
|
char pageLine[512] = "";
|
||||||
curses_move(0, 65 - static_cast<unsigned int>(strlen(firstLine)) - 1);
|
sprintf(pageLine, "Page %d of %d", cw->GetPage(), this->NumberOfPages);
|
||||||
printw(fmt_s, firstLine);
|
curses_move(0, 65 - static_cast<unsigned int>(strlen(pageLine)) - 1);
|
||||||
|
printw(fmt_s, pageLine);
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
pos_form_cursor(this->Form);
|
pos_form_cursor(this->Form);
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,9 @@ bool cmCursesStringWidget::PrintKeys()
|
|||||||
printw(fmt_s, firstLine);
|
printw(fmt_s, firstLine);
|
||||||
|
|
||||||
curses_move(y - 3, 0);
|
curses_move(y - 3, 0);
|
||||||
printw(fmt_s, "Editing option, press [enter] to leave edit.");
|
printw(fmt_s, "Editing option, press [enter] to confirm");
|
||||||
|
curses_move(y - 2, 0);
|
||||||
|
printw(fmt_s, " press [esc] to cancel");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user