From 944b0ae55dd89e48bf8845c6d5e08a73bd1c4917 Mon Sep 17 00:00:00 2001 From: Richard Kimberly Heck Date: Fri, 4 May 2018 13:05:36 -0400 Subject: [PATCH] Update the Advanced F&R document class when switching buffers. --- src/frontends/qt4/FindAndReplace.cpp | 15 +++++++++++++-- src/frontends/qt4/FindAndReplace.h | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt4/FindAndReplace.cpp b/src/frontends/qt4/FindAndReplace.cpp index a0d95684b2..96fcd588bd 100644 --- a/src/frontends/qt4/FindAndReplace.cpp +++ b/src/frontends/qt4/FindAndReplace.cpp @@ -67,6 +67,8 @@ FindAndReplaceWidget::FindAndReplaceWidget(GuiView & view) // We don't want two cursors blinking. find_work_area_->stopBlinkingCaret(); replace_work_area_->stopBlinkingCaret(); + old_buffer_ = view_.documentBufferView() ? + &(view_.documentBufferView()->buffer()) : 0; } @@ -605,8 +607,17 @@ bool FindAndReplace::initialiseParams(std::string const & params) void FindAndReplaceWidget::updateGUI() { - bool replace_enabled = view_.documentBufferView() - && !view_.documentBufferView()->buffer().isReadonly(); + BufferView * bv = view_.documentBufferView(); + if (bv) { + if (old_buffer_ != &bv->buffer()) { + copy_params(*bv, find_work_area_->bufferView()); + copy_params(*bv, replace_work_area_->bufferView()); + old_buffer_ = &bv->buffer(); + } + } else + old_buffer_ = 0; + + bool const replace_enabled = bv && !bv->buffer().isReadonly(); replace_work_area_->setEnabled(replace_enabled); replacePB->setEnabled(replace_enabled); replaceallPB->setEnabled(replace_enabled); diff --git a/src/frontends/qt4/FindAndReplace.h b/src/frontends/qt4/FindAndReplace.h index 93af535702..da854da7b7 100644 --- a/src/frontends/qt4/FindAndReplace.h +++ b/src/frontends/qt4/FindAndReplace.h @@ -40,6 +40,8 @@ public Q_SLOTS: private: /// GuiView & view_; + /// + Buffer * old_buffer_; /// add a string to the combo if needed void remember(std::string const & find, QComboBox & combo);