From 792636617d723b739fbfca970122c3a1ca9f4f52 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Fri, 22 Jul 2005 16:51:54 +0000 Subject: [PATCH] =?UTF-8?q?Squash=20a=20bug=20spotted=20by=20Udo=20M?= =?UTF-8?q?=EF=BF=BD=EF=BF=BDller=20in=20the=20XForms=20find=20&=20replace?= =?UTF-8?q?=20dialog.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10348 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/xforms/ChangeLog | 6 +++++- src/frontends/xforms/FormSearch.C | 21 +++++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index c927ce69a6..0e6097bf28 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,7 @@ +2005-07-22 Angus Leeming + + * FormSearch.C (input): do not trim the find and replace strings. + 2005-07-20 Jürgen Spitzmüller * FormDocument.C: @@ -15,7 +19,7 @@ "List" * forms/form_preferences.fd: remove spaces from messages * FormPreferences.C: simplify/clarify messages - + 2005-07-18 José Matos * FormDocument.C: new file format, remove support for a4.sty, diff --git a/src/frontends/xforms/FormSearch.C b/src/frontends/xforms/FormSearch.C index 375dc0e21e..d6c0dc4a67 100644 --- a/src/frontends/xforms/FormSearch.C +++ b/src/frontends/xforms/FormSearch.C @@ -15,7 +15,6 @@ #include "forms/form_search.h" #include "Tooltips.h" -#include "xforms_helpers.h" #include "xformsBC.h" #include "lyx_forms.h" @@ -71,10 +70,24 @@ void FormSearch::update() } +namespace { + +string const getUntrimmedString(FL_OBJECT * ob) +{ + BOOST_ASSERT(ob->objclass == FL_INPUT); + + char const * const tmp = fl_get_input(ob); + return tmp ? tmp : string(); +} + +} // namespace anon + + + ButtonPolicy::SMInput FormSearch::input(FL_OBJECT * ob, long) { if (ob == dialog_->button_findnext) { - controller().find(getString(dialog_->input_search), + controller().find(getUntrimmedString(dialog_->input_search), fl_get_button(dialog_->check_casesensitive), fl_get_button(dialog_->check_matchword), !fl_get_button(dialog_->check_searchbackwards)); @@ -82,8 +95,8 @@ ButtonPolicy::SMInput FormSearch::input(FL_OBJECT * ob, long) } else if (ob == dialog_->button_replace || ob == dialog_->button_replaceall) { bool const all = (ob == dialog_->button_replaceall); - controller().replace(getString(dialog_->input_search), - getString(dialog_->input_replace), + controller().replace(getUntrimmedString(dialog_->input_search), + getUntrimmedString(dialog_->input_replace), fl_get_button(dialog_->check_casesensitive), fl_get_button(dialog_->check_matchword), !fl_get_button(dialog_->check_searchbackwards),