From abdb992887fd4df6daedf94f1e8c1ebc4cf55303 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Sun, 9 Aug 2015 19:20:42 +0200 Subject: [PATCH] Reset status of highlighting/term data when loading doc in editor. Fixes search not working after using shift+arrow --- src/qtgui/preview_w.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/qtgui/preview_w.cpp b/src/qtgui/preview_w.cpp index 7bdfde59..b3864087 100644 --- a/src/qtgui/preview_w.cpp +++ b/src/qtgui/preview_w.cpp @@ -70,6 +70,12 @@ public: : m_curanchor(1), m_lastanchor(0) { } + void clear() { + m_curanchor = 1; + m_lastanchor = 0; + m_groupanchors.clear(); + m_groupcuranchors.clear(); + } bool haveAnchors() { @@ -840,7 +846,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum) sleep(1); } - LOGDEB(("LoadFileInCurrentTab: after file load: cancel %d status %d" + LOGDEB(("loadDocInCurrentTab: after file load: cancel %d status %d" " text length %d\n", CancelCheck::instance().cancelState(), status, fdoc.text.length())); @@ -879,6 +885,8 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum) list qrichlst; PreviewTextEdit *editor = currentEditor(); + editor->m_plaintorich->clear(); + // For an actual html file, if we want to have the images and // 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 @@ -997,7 +1005,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum) if (progress.wasCanceled()) { editor->append("Cancelled !"); - LOGDEB(("LoadFileInCurrentTab: cancelled in editor load\n")); + LOGDEB(("loadDocInCurrentTab: cancelled in editor load\n")); break; } } @@ -1079,7 +1087,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum) editor->setFocus(); emit(previewExposed(this, m_searchId, docnum)); - LOGDEB(("LoadFileInCurrentTab: returning true\n")); + LOGDEB(("loadDocInCurrentTab: returning true\n")); return true; }