Lars Gullik Bjønnes wrote:

> I made the decision that this bug will not be triggered a lot, and
> deemed it thus non-critical. Also lyx does not crash super-hard it is
> able to save the emergency file.

Here´s a workaround for another bug. Could you apply it to the stable tree
even maybe if there won´t be 1.0.3, so we won´t lose it. The devel-version
is for the devel cvs (surprise).

In case the user wants to replace a single string or an empty string,
a sorry box pops up. This had to be worked around because if the
user chose "Replace All" the loop wouldn´t end.

Regards
 Daniel

-- 
PGP Key fingerprint = 3D 98 9E D2 00 B6 E0 9D  7E B9 77 23 17 E2 11 6A
http://cgi4all.alabanza.com/glasatelier/
--- lyxfr1.C.org        Tue May  4 22:27:03 1999
+++ lyxfr1.C    Tue May  4 22:27:08 1999
@@ -153,6 +153,16 @@
                LyXBell();
                return;
        }
+
+       // CutSelection cannot cut a single space, so we have to stop
+       // in order to avoid endless loop :-(
+       ReInitFromForm();
+       if( SearchString().length() == 0 || (SearchString().length() == 1 
+               && SearchString()[0] == ' ') ) {
+               WriteAlert(_("Sorry!"), _("You cannot replace a single space\nor an 
+empty character."));
+               return;
+       }
+
        string const replacestring = ReplaceString();
 
        view->hideCursor();
--- lyxfr1.C.1.0.2      Tue May  4 22:14:48 1999
+++ lyxfr1.C    Tue May  4 22:02:45 1999
@@ -147,11 +147,21 @@
 void LyXFindReplace1::SearchReplaceCB()
 {
        LyXText         *ltCur;
-
+       
        if (!current_view->getScreen())
                return;
        if (current_view->currentBuffer()->isReadonly())
                return;
+
+       // CutSelection cannot cut a single space, so we have to stop
+       // in order to avoid endless loop :-(
+       ReInitFromForm();
+       if( SearchString().length() == 0 || (SearchString().length() == 1 
+               && SearchString()[0] == ' ') ) {
+               WriteAlert(_("Sorry!"), _("You cannot replace a single space\nor an 
+empty character."));
+               return;
+       }
+
        LString const replacestring = ReplaceString();
 
        current_view->getScreen()->HideCursor();
@@ -182,6 +192,16 @@
                return;
        if (current_view->currentBuffer()->isReadonly())
                return;
+
+       // CutSelection cannot cut a single space, so we have to stop
+       // in order to avoid endless loop :-(
+       ReInitFromForm();
+       if( SearchString().length() == 0 || (SearchString().length() == 1 
+               && SearchString()[0] == ' ') ) {
+               WriteAlert(_("Sorry!"), _("You cannot replace a single space\nor an 
+empty character."));
+               return;
+       }
+
        LString const replacestring = ReplaceString();
 
        current_view->getScreen()->HideCursor();

Reply via email to