Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

close #1628 #1630

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 30 additions & 24 deletions src/gdlhelp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1103,33 +1103,39 @@ void help_help(EnvT* e)
DStringGDL *previous_commands;
previous_commands = recall_commands_internal();
SizeT nEl2 = previous_commands->N_Elements();
cout << "Recall buffer length: " << nEl2 << '\n';

char ctmp;
int nb_lines=TermHeight();

for (SizeT i = 0; i < nEl2; ++i) {
if (isKWSetNames and
!CompareWithJokers(names, (*previous_commands)[i])) continue;
*ostrp << i + 1 << " " << (*previous_commands)[i] << '\n';
if (( i > 0) && (i % (nb_lines-4)) == 0) {
*ostrp << " < Press q or Q to quit, any key to continue, ? for help >" << '\n';
ctmp=my_get_kbrd();
nb_lines=TermHeight();
if ((tolower(ctmp) == 'h') || (ctmp == '?')) {
*ostrp << "--------------------------------------------------- " << '\n';
*ostrp << "<space> Display next page of text." << '\n';
*ostrp << "<return> Display next line of text. (TBD)" << '\n';
*ostrp << "q or Q Quit" << '\n';
*ostrp << "h, H, or ? Display this message." << '\n';
*ostrp << "---------------------------------------------------" << '\n';
ctmp=my_get_kbrd();
nb_lines=TermHeight();
if (doOutput) { //bug 1628
*ostrp << "Recall buffer length: " << nEl2 << '\n';
for (SizeT i = 0; i < nEl2; ++i) {
if (isKWSetNames and !CompareWithJokers(names, (*previous_commands)[i])) continue;
*ostrp << i + 1 << " " << (*previous_commands)[i] << '\n';
}
} else { //bug 1628
char ctmp;
int nb_lines = TermHeight();
*ostrp << "Recall buffer length: " << nEl2 << '\n';
for (SizeT i = 0; i < nEl2; ++i) {
if (isKWSetNames and !CompareWithJokers(names, (*previous_commands)[i])) continue;
*ostrp << i + 1 << " " << (*previous_commands)[i] << '\n';
if ((i > 0) && (i % (nb_lines - 4)) == 0) {
*ostrp << " < Press q or Q to quit, any key to continue, ? for help >" << '\n';
ctmp = my_get_kbrd();
nb_lines = TermHeight();
if ((tolower(ctmp) == 'h') || (ctmp == '?')) {
*ostrp << "--------------------------------------------------- " << '\n';
*ostrp << "<space> Display next page of text." << '\n';
*ostrp << "<return> Display next line of text. (TBD)" << '\n';
*ostrp << "q or Q Quit" << '\n';
*ostrp << "h, H, or ? Display this message." << '\n';
*ostrp << "---------------------------------------------------" << '\n';
ctmp = my_get_kbrd();
nb_lines = TermHeight();
}
if (tolower(ctmp) == 'q') break;
}
}
}
if (tolower(ctmp) == 'q') break;
}
}

GDLDelete(previous_commands);
if (doOutput) (*outputKW) = StreamToGDLString(ostr);
else cout << ostr.str();
Expand Down
Loading