On Mon, May 07, 2001 at 07:14:42PM +0200, Lars Gullik Bjønnes wrote:
> "Kayvan A. Sylvan" <[EMAIL PROTECTED]> writes:
> | This is just wrong. The first time through this part of the InsertChar function,
> | sent_space_message is set to true (regardless of whether the space message
> | is actually sent.
> | 
> | The setting of sent_space_message needs to accompany the actual sending
> | of the message (meaning, once for the "if" part and once for the "else"):
> 
> why? sent_space_message = true is going to be exectued regardless of
> the branch.

I don't know where my brain was when I composed that message.

I am just plain wrong.

Here's the fixed patch. ;-) 

> | This horse is quickly approaching rigor mortis. ;-)
> 
> Let's kill it first.

Is it dead now?

                        ---Kayvan
Index: src/ChangeLog
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/ChangeLog,v
retrieving revision 1.157
diff -u -r1.157 ChangeLog
--- src/ChangeLog       2001/05/04 10:36:34     1.157
+++ src/ChangeLog       2001/05/07 18:26:16
@@ -1,3 +1,9 @@
+2001-05-04  Kayvan A. Sylvan  <[EMAIL PROTECTED]>
+
+       * text.C (InsertChar): Added trivial patch to only send the "you
+       can not do multiple spaces this way" message once during a
+       session.
+
 2001-05-04  Lars Gullik Bjønnes  <[EMAIL PROTECTED]>
 
        * minibuffer.C (peek_event): temporarily reduce the functionality
Index: src/text.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/text.C,v
retrieving revision 1.147
diff -u -r1.147 text.C
--- src/text.C  2001/05/03 14:31:31     1.147
+++ src/text.C  2001/05/07 18:26:16
@@ -1778,10 +1778,14 @@
                    || (cursor.pos() > 0
                        && cursor.par()->IsNewline(cursor.pos() - 1))
                    || (cursor.pos() == 0)) {
-                       if (cursor.pos() == 0 )
-                               bview->owner()->message(_("You cannot insert a space 
at the beginning of a paragraph.  Please read the Tutorial."));
-                       else
-                               bview->owner()->message(_("You cannot type two spaces 
this way.  Please read the Tutorial."));
+                       static bool sent_space_message = false;
+                       if (!sent_space_message) {
+                               if (cursor.pos() == 0) 
+                                       bview->owner()->message(_("You cannot insert a 
+space at the beginning of a paragraph.  Please read the Tutorial."));
+                               else
+                                       bview->owner()->message(_("You cannot type two 
+spaces this way.  Please read the Tutorial."));
+                               sent_space_message = true;
+                       }
                        charInserted();
                        return;
                }

Reply via email to