]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
oh well
[lyx.git] / src / lyxfunc.C
index 63afaf34d77d18ec8c7e67a96d8aec49e45feb1d..e71a977d1db6b0d9d3221eea704a0aca003be7d8 100644 (file)
@@ -661,9 +661,13 @@ FuncStatus LyXFunc::getStatus(kb_action action,
        case LFUN_MENU_SEPARATOR:
        case LFUN_LDOTS:
        case LFUN_END_OF_SENTENCE:
-       case LFUN_PROTECTEDSPACE:
                code = Inset::SPECIALCHAR_CODE;
                break;
+       case LFUN_PROTECTEDSPACE:
+               // slight hack: we know this is allowed in math mode
+               if (!mathcursor)
+                       code = Inset::SPECIALCHAR_CODE;
+               break;
        default:
                break;
        }
@@ -885,6 +889,12 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                if ((action > 1) || ((action == LFUN_UNKNOWN_ACTION) &&
                                     (!keyseq.deleted())))
                {
+                       UpdatableInset * inset = owner->view()->theLockingInset();
+#if 1
+                       int inset_x;
+                       int dummy_y;
+                       inset->getCursorPos(owner->view(), inset_x, dummy_y);
+#endif
                        if ((action == LFUN_UNKNOWN_ACTION)
                            && argument.empty()) {
                                argument = keyseq.getiso();
@@ -896,7 +906,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                        } else if (action == LFUN_REDO) {
                                owner->view()->menuRedo();
                                goto exit_with_message;
-                       } else if (((result=owner->view()->theLockingInset()->
+                       } else if (((result=inset->
                                     // Hand-over to inset's own dispatch:
                                     localDispatch(owner->view(), action, argument)) ==
                                    UpdatableInset::DISPATCHED) ||
@@ -918,21 +928,43 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                                }
                                goto exit_with_message;
                        } else if (result == UpdatableInset::FINISHED_UP) {
-                               if (TEXT()->cursor.row()->previous()) {
+                               if (TEXT()->cursor.irow()->previous()) {
+#if 1
+                                       TEXT()->setCursorFromCoordinates(
+                                               owner->view(), TEXT()->cursor.ix() + inset_x,
+                                               TEXT()->cursor.iy() -
+                                               TEXT()->cursor.irow()->baseline() - 1);
+                                       TEXT()->cursor.x_fix(TEXT()->cursor.x());
+#else
                                        TEXT()->cursorUp(owner->view());
+#endif
                                        moveCursorUpdate(true, false);
                                        owner->showState();
+                               } else {
+                                       owner->view()->update(TEXT(), BufferView::SELECT|BufferView::FITCUR);
                                }
                                goto exit_with_message;
                        } else if (result == UpdatableInset::FINISHED_DOWN) {
-                               if (TEXT()->cursor.row()->next())
+                               if (TEXT()->cursor.irow()->next()) {
+#if 1
+                                       TEXT()->setCursorFromCoordinates(
+                                               owner->view(), TEXT()->cursor.ix() + inset_x,
+                                               TEXT()->cursor.iy() -
+                                               TEXT()->cursor.irow()->baseline() +
+                                               TEXT()->cursor.irow()->height() + 1);
+                                       TEXT()->cursor.x_fix(TEXT()->cursor.x());
+#else
                                        TEXT()->cursorDown(owner->view());
-                               else
+#endif
+                               } else {
                                        TEXT()->cursorRight(owner->view());
+                               }
                                moveCursorUpdate(true, false);
                                owner->showState();
                                goto exit_with_message;
-                       } else {
+                       }
+#warning I am not sure this is still right, please have a look! (Jug 20020417)
+                       else { // result == UNDISPATCHED
                                //setMessage(N_("Text mode"));
                                switch (action) {
                                case LFUN_UNKNOWN_ACTION:
@@ -993,6 +1025,8 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                                                        true);
                        }
                        finishUndo();
+                       // Tell the paragraph dialog that we changed paragraph
+                       owner->getDialogs()->updateParagraph();
                }
        }
        break;