]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiApplication.cpp
Amend f441590c
[lyx.git] / src / frontends / qt4 / GuiApplication.cpp
index 8a5377f6294d3e8f9bd89e289fb4eafc61207733..4b6e769ddf89d1feba72f20a3ec72c700f9eb982 100644 (file)
@@ -2160,9 +2160,15 @@ void GuiApplication::processKeySym(KeySymbol const & keysym, KeyModifier state)
                        // must not be inserted (#5704)
                        if (!isPrintable(encoded_last_key)) {
                                LYXERR(Debug::KEY, "Non-printable character! Omitting.");
-                               current_view_->restartCursor();
+                               if (current_view_)
+                                       current_view_->restartCursor();
                                return;
                        }
+                       // The following modifier check is not needed on Mac.
+                       // The keysym is either not text or it is different
+                       // from the non-modifier keysym. See #9875 for the
+                       // broken alt-modifier effect of having this code active.
+#if !defined(Q_OS_MAC)
                        // If a non-Shift Modifier is used we have a non-bound key sequence
                        // (such as Alt+j = j). This should be omitted (#5575).
                        // On Windows, AltModifier and ControlModifier are both
@@ -2173,11 +2179,15 @@ void GuiApplication::processKeySym(KeySymbol const & keysym, KeyModifier state)
 #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
                            && !(state & AltModifier && state & ControlModifier)
 #endif
-                           ) {
-                               current_view_->message(_("Unknown function."));
-                               current_view_->restartCursor();
+                           )
+                       {
+                               if (current_view_) {
+                                       current_view_->message(_("Unknown function."));
+                                       current_view_->restartCursor();
+                               }
                                return;
                        }
+#endif
                        // Since all checks above were passed, we now really have text that
                        // is to be inserted (e.g., AltGr-bound symbols). Thus change the
                        // func to LFUN_SELF_INSERT and thus cause the text to be inserted