From ea6a0078e0daf8f4eb2e2638dc005faecd4134b6 Mon Sep 17 00:00:00 2001 From: nowrep Date: Sat, 19 Mar 2011 13:14:43 +0100 Subject: [PATCH] Added wrapping for backward finding --- src/other/sourceviewersearch.cpp | 5 +++-- src/other/sourceviewersearch.ui | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/other/sourceviewersearch.cpp b/src/other/sourceviewersearch.cpp index f31a6696d..dc2654495 100644 --- a/src/other/sourceviewersearch.cpp +++ b/src/other/sourceviewersearch.cpp @@ -52,7 +52,8 @@ SourceViewerSearch::SourceViewerSearch(SourceViewer* parent) : ui->lineEdit->setFocus(); startAnimation(); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide())); - connect(ui->lineEdit, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(next())); + connect(ui->lineEdit, SIGNAL(textEdited(QString)), this, SLOT(next())); + connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(next())); connect(ui->next, SIGNAL(clicked()), this, SLOT(next())); connect(ui->previous, SIGNAL(clicked()), this, SLOT(previous())); } @@ -97,7 +98,7 @@ bool SourceViewerSearch::find(QTextDocument::FindFlags flags) if (!m_sourceViewer->sourceEdit()->find(string, flags)) { QTextCursor cursor = m_sourceViewer->sourceEdit()->textCursor(); - m_sourceViewer->sourceEdit()->moveCursor(QTextCursor::Start); + m_sourceViewer->sourceEdit()->moveCursor( (flags == QTextDocument::FindBackward ) ? QTextCursor::End : QTextCursor::Start ); if (!m_sourceViewer->sourceEdit()->find(string,flags)) { cursor.clearSelection(); m_sourceViewer->sourceEdit()->setTextCursor(cursor); diff --git a/src/other/sourceviewersearch.ui b/src/other/sourceviewersearch.ui index f5113b730..34614ecd9 100644 --- a/src/other/sourceviewersearch.ui +++ b/src/other/sourceviewersearch.ui @@ -32,7 +32,7 @@ - Esc + Esc true