On Sat, May 05, 2001 at 01:50:20PM +1000, Allan Rae wrote: > On Fri, 4 May 2001, Kayvan A. Sylvan wrote: > > > Here's the patch. > > Somebody correct me if I'm wrong but can't the static bool be placed > at a minimal scope (just before the inner conditional). That would keep > the variable next to where it's used and it minimize its scope. Since > it's static it'll still be there next time through the code. > > Maybe I'm still not fully awake. > > Allan. (ARRae) Here's the corrected patch.
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 04:59: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 04:59:16 @@ -1773,15 +1773,19 @@ bool jumped_over_space = false; if (!freeSpacing && IsLineSeparatorChar(c)) { + static bool sent_space_message = false; if ((cursor.pos() > 0 && cursor.par()->IsLineSeparator(cursor.pos() - 1)) || (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.")); + if (cursor.pos() == 0) { + if (!sent_space_message) +bview->owner()->message(_("You cannot insert a space at the beginning of a paragraph. + Please read the Tutorial.")); + sent_space_message = true; + } else { + if (!sent_space_message) +bview->owner()->message(_("You cannot type two spaces this way. Please read the +Tutorial.")); + sent_space_message = true; + } charInserted(); return; }