]> git.lyx.org Git - lyx.git/blobdiff - src/text3.C
added a parseError signal to Buffer and use it
[lyx.git] / src / text3.C
index 98998c59add93c2559f36826e9f96ecd7933ad8d..8ded18b4d1ba5ae66e988253ddcbd4e0c1717398 100644 (file)
@@ -27,6 +27,7 @@
 #include "box.h"
 #include "language.h"
 #include "support/tostr.h"
+#include "support/lstrings.h"
 #include "frontends/LyXView.h"
 #include "frontends/screen.h"
 #include "frontends/Dialogs.h"
@@ -342,10 +343,11 @@ void LyXText::cursorNext()
                }
        }
        bv()->screen().draw(bv()->text, bv(), new_y);
-       if (boost::next(cursor.row()) != rows().end()) {
+
+       RowList::iterator next_row = boost::next(cursor.row());
+       if (next_row != rows().end()) {
                LyXCursor cur;
-               setCursor(cur, boost::next(cursor.row())->par(),
-                         boost::next(cursor.row())->pos(), false);
+               setCursor(cur, next_row->par(), next_row->pos(), false);
                if (cur.y() < top_y() + bv()->workHeight()) {
                        cursorDown(true);
                }
@@ -381,7 +383,7 @@ void doInsertInset(LyXText * lt, FuncRequest const & cmd,
        if (inset) {
                bool gotsel = false;
                if (lt->selection.set()) {
-                       lt->cutSelection(true, false);
+                       bv->owner()->dispatch(FuncRequest(LFUN_CUT));
                        gotsel = true;
                }
                if (bv->insertInset(inset)) {
@@ -390,7 +392,7 @@ void doInsertInset(LyXText * lt, FuncRequest const & cmd,
                                inset->localDispatch(cmd);
                        }
                        if (gotsel && pastesel)
-                               bv->owner()->dispatch(FuncRequest(LFUN_PASTESELECTION));
+                               bv->owner()->dispatch(FuncRequest(LFUN_PASTE));
                }
                else
                        delete inset;
@@ -608,7 +610,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                    && isHighlyEditableInset(cursor.par()->getInset(cursor.pos()))) {
                        Inset * tmpinset = cursor.par()->getInset(cursor.pos());
                        cmd.message(tmpinset->editMessage());
-                       FuncRequest cmd1(bv, LFUN_INSET_EDIT, is_rtl ? "left" : "right");
+                       FuncRequest cmd1(bv, LFUN_INSET_EDIT, is_rtl ? "right" : "left");
                        tmpinset->localDispatch(cmd1);
                        break;
                }
@@ -634,7 +636,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                    isHighlyEditableInset(cursor.par()->getInset(cursor.pos()))) {
                        Inset * tmpinset = cursor.par()->getInset(cursor.pos());
                        cmd.message(tmpinset->editMessage());
-                       FuncRequest cmd1(bv, LFUN_INSET_EDIT, is_rtl ? "right" : "left");
+                       FuncRequest cmd1(bv, LFUN_INSET_EDIT, is_rtl ? "left" : "right");
                        tmpinset->localDispatch(cmd1);
                        break;
                }
@@ -736,7 +738,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        // just comment out the line below...
                } else {
                        update();
-                       cutSelection(bv, true);
+                       cutSelection(true, false);
                        update();
                }
                moveCursorUpdate(bv, false);
@@ -777,7 +779,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        }
                } else {
                        update();
-                       cutSelection(bv, true);
+                       cutSelection(true, false);
                }
                update();
                break;
@@ -794,7 +796,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        }
                } else {
                        update();
-                       cutSelection(bv, true);
+                       cutSelection(true, false);
                        update();
                }
                bv->owner()->view_state_changed();
@@ -823,7 +825,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        }
                } else {
                        update();
-                       cutSelection(bv, true);
+                       cutSelection(true, false);
                }
                update();
                break;
@@ -1020,21 +1022,29 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                update();
                break;
 
-       case LFUN_PASTE:
+       case LFUN_PASTE: {
                cmd.message(_("Paste"));
                // clear the selection
                bv->toggleSelection();
                clearSelection();
                update();
-               pasteSelection();
+               size_t sel_index = 0;
+               string const & arg = cmd.argument;
+               if (isStrUnsignedInt(arg)) {
+                       size_t const paste_arg = strToUnsignedInt(arg);
+#warning FIXME Check if the arg is in the domain of available selections.
+                       sel_index = paste_arg;
+               }
+               pasteSelection(sel_index);
                clearSelection(); // bug 393
                update();
                bv->switchKeyMap();
                break;
+       }
 
        case LFUN_CUT:
                update();
-               cutSelection(bv, true);
+               cutSelection(true, true);
                update();
                cmd.message(_("Cut"));
                break;
@@ -1598,7 +1608,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                break;
 
        case LFUN_INDEX_PRINT:
-       case LFUN_PARENTINSERT:
        case LFUN_TOC_INSERT:
        case LFUN_HFILL:
                // do nothing fancy