Updated search function

Incremental search is disabled now by default
This commit is contained in:
Moritz Lipp 2010-03-08 21:49:41 +01:00
parent c3b3403a24
commit f84f6a42f8
2 changed files with 7 additions and 5 deletions

View file

@ -129,8 +129,8 @@ BufferCommand buffer_commands[] = {
/* special commands */ /* special commands */
SpecialCommand special_commands[] = { SpecialCommand special_commands[] = {
/* identifier, function, a, argument */ /* identifier, function, a, argument */
{'/', scmd_search, 1, { DOWN } }, {'/', scmd_search, 0, { DOWN } },
{'?', scmd_search, 1, { UP } }, {'?', scmd_search, 0, { UP } },
}; };
/* settings */ /* settings */

View file

@ -1076,9 +1076,13 @@ search(void* parameter)
pthread_mutex_lock(&(Zathura.Lock.document_lock)); pthread_mutex_lock(&(Zathura.Lock.document_lock));
PopplerPage* page = poppler_document_get_page(Zathura.PDF.document, next_page); PopplerPage* page = poppler_document_get_page(Zathura.PDF.document, next_page);
pthread_mutex_unlock(&(Zathura.Lock.document_lock)); pthread_mutex_unlock(&(Zathura.Lock.document_lock));
if(!page) if(!page)
pthread_exit(NULL); pthread_exit(NULL);
pthread_mutex_lock(&(Zathura.PDF.pages[next_page]->lock));
results = poppler_page_find_text(page, search_item); results = poppler_page_find_text(page, search_item);
pthread_mutex_unlock(&(Zathura.PDF.pages[next_page]->lock));
if(results) if(results)
break; break;
@ -2867,9 +2871,7 @@ int main(int argc, char* argv[])
arg.n = ADJUST_OPEN; arg.n = ADJUST_OPEN;
sc_adjust_window(&arg); sc_adjust_window(&arg);
if(!g_thread_supported()) g_thread_init(NULL);
g_thread_init(NULL);
gdk_threads_init();
gtk_main(); gtk_main();
return 0; return 0;