Initialize F&R dialog with selected text (#8448)

This commit is contained in:
Juergen Spitzmueller 2021-02-15 16:04:17 +01:00
parent 21fa3f3f94
commit c4fbd0d913
3 changed files with 15 additions and 1 deletions

View File

@ -91,6 +91,14 @@ GuiSearchWidget::GuiSearchWidget(QWidget * parent)
}
bool GuiSearchWidget::initialiseParams(std::string const & str)
{
if (!str.empty())
findCO->lineEdit()->setText(toqstr(str));
return true;
}
void GuiSearchWidget::keyPressEvent(QKeyEvent * ev)
{
KeySymbol sym;

View File

@ -38,6 +38,8 @@ public:
///
void setBufferView(BufferView const * bv) { bv_ = bv; }
///
bool initialiseParams(std::string const &);
///
bool isMinimized() { return minimized_; }
private Q_SLOTS:
@ -85,7 +87,8 @@ public:
/// Controller inherited method.
///@{
bool initialiseParams(std::string const &) override { return true; }
bool initialiseParams(std::string const & sdata) override
{ return widget_->initialiseParams(sdata); }
void clearParams() override {}
void dispatchParams() override {}
bool isBufferDependent() const override { return true; }

View File

@ -4426,6 +4426,9 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
sdata = bv->cursor().getEncoding()->name();
if (!sdata.empty())
showDialog("symbols", sdata);
} else if (name == "findreplace") {
sdata = to_utf8(bv->cursor().selectionAsString(false));
showDialog(name, sdata);
// bug 5274
} else if (name == "prefs" && isFullScreen()) {
lfunUiToggle("fullscreen");