From 59aae2aa8349a1ee8589d4cdfa9b11dfb529aef0 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Thu, 11 Oct 2007 12:31:48 +0000 Subject: [PATCH] Don't restart the blinking cursor inside WorkArea because some shortcuts can delete the current WorkArea. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20900 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/LyXFunc.cpp | 16 ++++++++++++++++ src/frontends/WorkArea.cpp | 5 ----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index b0493ac123..1feb1c7cfa 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -314,6 +314,17 @@ void LyXFunc::gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer) } +namespace { +void restartCursor(LyXView * lv) +{ + /* When we move around, or type, it's nice to be able to see + * the cursor immediately after the keypress. + */ + if (lv && lv->currentWorkArea()) + lv->currentWorkArea()->startBlinkingCursor(); +} +} + void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state) { LYXERR(Debug::KEY) << "KeySym is " << keysym.getSymbolName() << endl; @@ -322,11 +333,13 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state) if (!keysym.isOK()) { LYXERR(Debug::KEY) << "Empty kbd action (probably composing)" << endl; + restartCursor(lyx_view_); return; } if (keysym.isModifier()) { LYXERR(Debug::KEY) << "isModifier true" << endl; + restartCursor(lyx_view_); return; } @@ -396,6 +409,7 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state) } else { LYXERR(Debug::KEY) << "Unknown, !isText() - giving up" << endl; lyx_view_->message(_("Unknown function.")); + restartCursor(lyx_view_); return; } } @@ -411,6 +425,8 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state) } else { dispatch(func); } + + restartCursor(lyx_view_); } diff --git a/src/frontends/WorkArea.cpp b/src/frontends/WorkArea.cpp index f1114df40d..86a4d93cf5 100644 --- a/src/frontends/WorkArea.cpp +++ b/src/frontends/WorkArea.cpp @@ -171,11 +171,6 @@ void WorkArea::processKeySym(KeySymbol const & key, KeyModifier mod) theLyXFunc().setLyXView(lyx_view_); theLyXFunc().processKeySym(key, mod); - - /* When we move around, or type, it's nice to be able to see - * the cursor immediately after the keypress. - */ - startBlinkingCursor(); } -- 2.39.2