From 116c7c34c3127cd4ce6b3ab78f8fdde0fa4d91e1 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Fri, 2 Oct 2009 23:13:19 +0000 Subject: [PATCH] We cannot use a static int as there are usually multiple InsetText in a same document. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31491 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Text.cpp | 7 +++---- src/Text.h | 4 +++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Text.cpp b/src/Text.cpp index cb9531d19d..1bf7d61135 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -927,12 +927,11 @@ void Text::charInserted(Cursor & cur) // Here we call finishUndo for every 20 characters inserted. // This is from my experience how emacs does it. (Lgb) - static unsigned int counter; - if (counter < 20) { - ++counter; + if (undo_counter_ < 20) { + ++undo_counter_; } else { cur.finishUndo(); - counter = 0; + undo_counter_ = 0; } // register word if a non-letter was entered diff --git a/src/Text.h b/src/Text.h index 79e026b6c5..c8073eec71 100644 --- a/src/Text.h +++ b/src/Text.h @@ -41,7 +41,7 @@ class Text { public: /// constructor explicit Text(InsetText * owner) - : owner_(owner), autoBreakRows_(false) + : owner_(owner), autoBreakRows_(false), undo_counter_(0) {} /// \return true if there's no content at all. @@ -368,6 +368,8 @@ private: bool autoBreakRows_; /// position of the text in the buffer. DocIterator macrocontext_position_; + /// + unsigned int undo_counter_; }; -- 2.39.5