r20441 by craig -
scribus-commit
scribus-commit at lists.scribus.net
Sun Oct 4 03:27:09 UTC 2015
Author: craig
Date: Sun Oct 4 03:27:09 2015
New Revision: 20441
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20441
Log:
#12091: Leave text cursor at search position in Story Editor when closing search dialog
Modified:
trunk/Scribus/scribus/ui/search.cpp
trunk/Scribus/scribus/ui/search.h
trunk/Scribus/scribus/ui/storyeditor.cpp
trunk/Scribus/scribus/ui/storyeditor.h
Modified: trunk/Scribus/scribus/ui/search.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20441&path=/trunk/Scribus/scribus/ui/search.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/search.cpp (original)
+++ trunk/Scribus/scribus/ui/search.cpp Sun Oct 4 03:27:09 2015
@@ -45,6 +45,7 @@
m_doc = doc;
m_notFound = false;
m_itemMode = mode;
+ m_firstMatchPosition = -1;
setModal(true);
setWindowTitle( tr( "Search/Replace" ) );
@@ -550,7 +551,8 @@
do
{
found = storyTextEdit->find(sText, flags);
- if (!found) break;
+ if (!found)
+ break;
QTextCursor cursor = storyTextEdit->textCursor();
int selStart = cursor.selectionStart();
for (int ap = 0; ap < sText.length(); ++ap)
@@ -639,6 +641,7 @@
AllReplace->setEnabled(true);
}
matchesFound++;
+ m_firstMatchPosition = storyTextEdit->textCursor().selectionStart();
}
else
{
@@ -800,6 +803,11 @@
DoReplace->setEnabled(false);
AllReplace->setEnabled(false);
slotDoSearch();
+}
+
+int SearchReplace::firstMatchCursorPosition()
+{
+ return m_firstMatchPosition;
}
void SearchReplace::slotReplaceAll()
Modified: trunk/Scribus/scribus/ui/search.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20441&path=/trunk/Scribus/scribus/ui/search.h
==============================================================================
--- trunk/Scribus/scribus/ui/search.h (original)
+++ trunk/Scribus/scribus/ui/search.h Sun Oct 4 03:27:09 2015
@@ -37,6 +37,7 @@
~SearchReplace() {};
virtual void slotDoSearch();
virtual void slotDoReplace();
+ int firstMatchCursorPosition();
QLabel* SText1;
QLabel* RText1;
@@ -140,6 +141,7 @@
/// Number of matches found thus far in a search
int matchesFound;
+ int m_firstMatchPosition;
};
Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20441&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp (original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp Sun Oct 4 03:27:09 2015
@@ -1541,8 +1541,8 @@
m_textChanged(false),
m_firstSet(false),
m_blockUpdate(false),
- m_currPara(0),
- m_currChar(0),
+// m_currPara(0),
+// m_currChar(0),
charSelect(NULL),
charSelectUsed(false)
{
@@ -3007,6 +3007,13 @@
EditorBar->setRepaint(false);
SearchReplace* dia = new SearchReplace(this, m_doc, m_item, false);
dia->exec();
+ int pos = dia->firstMatchCursorPosition();
+ if (pos>=0)
+ {
+ QTextCursor tCursor = Editor->textCursor();
+ tCursor.setPosition(pos);
+ Editor->setTextCursor(tCursor);
+ }
delete dia;
qApp->processEvents();
m_blockUpdate = false;
Modified: trunk/Scribus/scribus/ui/storyeditor.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20441&path=/trunk/Scribus/scribus/ui/storyeditor.h
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.h (original)
+++ trunk/Scribus/scribus/ui/storyeditor.h Sun Oct 4 03:27:09 2015
@@ -425,8 +425,8 @@
bool m_blockUpdate;
int m_result;
- int m_currPara;
- int m_currChar;
+// int m_currPara;
+// int m_currChar;
protected slots:
void setBackPref();
More information about the scribus-commit
mailing list