limit max length of displayed query details. 1.3.2

This commit is contained in:
dockes 2006-04-01 21:02:12 +00:00
parent 52130a7657
commit ba30158867
2 changed files with 11 additions and 4 deletions

View File

@ -1 +1 @@
1.3.1 1.3.2

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.16 2006-04-01 08:07:43 dockes Exp $ (C) 2005 J.F.Dockes"; static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.17 2006-04-01 21:02:12 dockes Exp $ (C) 2005 J.F.Dockes";
#endif #endif
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -527,10 +527,13 @@ void RclMain::enablePrevPage(bool yesno)
/** Show detailed expansion of a query */ /** Show detailed expansion of a query */
void RclMain::showQueryDetails() void RclMain::showQueryDetails()
{ {
// Break query into lines of reasonable length, avoid cutting words! // Break query into lines of reasonable length, avoid cutting words,
const unsigned int ll = 80; // Also limit the total number of lines.
const unsigned int ll = 100;
const unsigned int maxlines = 50;
string query = currentQueryData.description; string query = currentQueryData.description;
string oq; string oq;
unsigned int nlines = 0;
while (query.length() > 0) { while (query.length() > 0) {
string ss = query.substr(0, ll); string ss = query.substr(0, ll);
if (ss.length() == ll) { if (ss.length() == ll) {
@ -552,6 +555,10 @@ void RclMain::showQueryDetails()
break; break;
} }
oq += ss + "\n"; oq += ss + "\n";
if (nlines++ >= maxlines) {
oq += " ... \n";
break;
}
query= query.substr(ss.length()); query= query.substr(ss.length());
LOGDEB1(("oq [%s]\n, query [%s]\n, ss [%s]\n", LOGDEB1(("oq [%s]\n, query [%s]\n, ss [%s]\n",
oq.c_str(), query.c_str(), ss.c_str())); oq.c_str(), query.c_str(), ss.c_str()));