Reset status of highlighting/term data when loading doc in editor. Fixes search not working after using shift+arrow

This commit is contained in:
Jean-Francois Dockes 2015-08-09 19:20:42 +02:00
parent 4d1f679eac
commit abdb992887

View File

@ -70,6 +70,12 @@ public:
: m_curanchor(1), m_lastanchor(0) : m_curanchor(1), m_lastanchor(0)
{ {
} }
void clear() {
m_curanchor = 1;
m_lastanchor = 0;
m_groupanchors.clear();
m_groupcuranchors.clear();
}
bool haveAnchors() bool haveAnchors()
{ {
@ -840,7 +846,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
sleep(1); sleep(1);
} }
LOGDEB(("LoadFileInCurrentTab: after file load: cancel %d status %d" LOGDEB(("loadDocInCurrentTab: after file load: cancel %d status %d"
" text length %d\n", " text length %d\n",
CancelCheck::instance().cancelState(), status, fdoc.text.length())); CancelCheck::instance().cancelState(), status, fdoc.text.length()));
@ -879,6 +885,8 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
list<QString> qrichlst; list<QString> qrichlst;
PreviewTextEdit *editor = currentEditor(); PreviewTextEdit *editor = currentEditor();
editor->m_plaintorich->clear();
// For an actual html file, if we want to have the images and // For an actual html file, if we want to have the images and
// style loaded in the preview, we need to set the search // style loaded in the preview, we need to set the search
// path. Not too sure this is a good idea as I find them rather // path. Not too sure this is a good idea as I find them rather
@ -997,7 +1005,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
if (progress.wasCanceled()) { if (progress.wasCanceled()) {
editor->append("<b>Cancelled !</b>"); editor->append("<b>Cancelled !</b>");
LOGDEB(("LoadFileInCurrentTab: cancelled in editor load\n")); LOGDEB(("loadDocInCurrentTab: cancelled in editor load\n"));
break; break;
} }
} }
@ -1079,7 +1087,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
editor->setFocus(); editor->setFocus();
emit(previewExposed(this, m_searchId, docnum)); emit(previewExposed(this, m_searchId, docnum));
LOGDEB(("LoadFileInCurrentTab: returning true\n")); LOGDEB(("loadDocInCurrentTab: returning true\n"));
return true; return true;
} }