bugfix: crash on backward search

svn path=/trunk/kdegraphics/kdvi/; revision=195097
remotes/origin/kdvi-3.2
Stefan Kebekus 24 years ago
parent d8d6a6fca7
commit a36c3bf87b
  1. 9
      dviwin_textsearch.cpp

@ -90,7 +90,7 @@ void dviWindow::findNextText(void)
// Go trough the text of the current page and search for the // Go trough the text of the current page and search for the
// string. // string.
for(int i=DVIselection.selectedTextStart+1; i<textLinkList.size(); i++) for(unsigned int i=DVIselection.selectedTextStart+1; i<textLinkList.size(); i++)
if (textLinkList[i].linkText.find(searchText, 0, case_sensitive) >= 0) { if (textLinkList[i].linkText.find(searchText, 0, case_sensitive) >= 0) {
// Restore the previous settings, including the current // Restore the previous settings, including the current
// page. Otherwise, the program is "smart enough" not to // page. Otherwise, the program is "smart enough" not to
@ -208,7 +208,6 @@ void dviWindow::findPrevText(void)
} }
} }
progress.setProgress( lastPageOfSearch - current_page ); progress.setProgress( lastPageOfSearch - current_page );
qApp->processEvents(); qApp->processEvents();
if ( progress.wasCancelled() ) if ( progress.wasCancelled() )
@ -218,8 +217,8 @@ void dviWindow::findPrevText(void)
// string. // string.
int i=DVIselection.selectedTextStart-1; int i=DVIselection.selectedTextStart-1;
if (i < 0) if (i < 0)
i = textLinkList.size(); i = textLinkList.size()-1;
do{ while(i >= 0) {
if (textLinkList[i].linkText.find(searchText, 0, case_sensitive) >= 0) { if (textLinkList[i].linkText.find(searchText, 0, case_sensitive) >= 0) {
// Restore the previous settings, including the current // Restore the previous settings, including the current
// page. Otherwise, the program is "smart enough" not to // page. Otherwise, the program is "smart enough" not to
@ -233,7 +232,7 @@ void dviWindow::findPrevText(void)
return; return;
} }
i--; i--;
}while(i >= 0); }
current_page--; current_page--;
DVIselection.clear(); DVIselection.clear();
foreGroundPaint.begin( &pixie ); foreGroundPaint.begin( &pixie );

Loading…
Cancel
Save