>>>>> "Jürgen" == Jürgen Spitzmüller <[EMAIL PROTECTED]> writes:

Jürgen> Jean-Marc Lasgouttes wrote:
>> Is the thing correct when there is no selection? I would think the
>> replace() then searches for the next hit. Of course, this is
>> difficult to get right, but at least a FIXME would be useful.

Jürgen> I would think everythink would be OK if the "replace" and
Jürgen> "replace all" buttons would be greyed out if disabled. Why
Jürgen> should "replace" do nothing but search for the next hit?

My reading of the replace() function in lyxfind.cpp seemed to imply
this. But I may be wrong. In particular, it seems to me that
stringSelected is eventually invoked and can do an extra search.

>> What happens when there is a multi paragraph selection? Does LyX
>> just crash?

Jürgen> No. It does nothing (as it should IMHO).

+               DocIterator beg = cur.selectionBegin();
+               DocIterator end = cur.selectionEnd();
+               bool enabled = true;
+               for (pos_type p = beg.pos() ; p < end.pos() ; ++p) {
+                       if (cur.paragraph().isDeleted(p))
+                               enabled = false;
+               }

reading the code above, I would say that it crashes if selectionBegin
and selectionEnd are not the same paragraph and the paragraphs have
different number of characters. First, can you even tell me which
paragraph is cur.paragraph()?

I think a test should be added.

JMarc

Reply via email to