]> git.lyx.org Git - lyx.git/blobdiff - src/text3.C
"Inter-word Space"
[lyx.git] / src / text3.C
index a3657a90678b328b3c2216d1503297626af9cd60..6da72b34b15bdf54b5bab6e6a09cf0a4c7db30b6 100644 (file)
@@ -95,20 +95,20 @@ namespace {
                LyXCursor const & cur, int & x, int & y)
        {
                lyx::pos_type const pos = cur.pos();
-               Paragraph /*const*/ & par = *cur.par();
+               ParagraphList::iterator par = cur.par();
 
-               if (pos >= par.size() || !par.isInset(pos))
+               if (pos >= par->size() || !par->isInset(pos))
                        return 0;
 
-               Inset /*const*/ * inset = par.getInset(pos);
+               Inset /*const*/ * inset = par->getInset(pos);
 
                if (!isEditableInset(inset))
                        return 0;
 
                // get inset dimensions
-               lyx::Assert(par.getInset(pos));
+               lyx::Assert(par->getInset(pos));
 
-               LyXFont const & font = text.getFont(bv->buffer(), &par, pos);
+               LyXFont const & font = text.getFont(bv->buffer(), par, pos);
 
                int const width = inset->width(bv, font);
                int const inset_x = font.isVisibleRightToLeft()
@@ -128,7 +128,7 @@ namespace {
                        return 0;
                }
 
-               text.setCursor(&par, pos, true);
+               text.setCursor(par, pos, true);
 
                x -= b.x1;
                // The origin of an inset is on the baseline
@@ -385,8 +385,10 @@ void doInsertInset(LyXText * lt, FuncRequest const & cmd,
                        gotsel = true;
                }
                if (bv->insertInset(inset)) {
-                       if (edit)
-                               inset->edit(bv);
+                       if (edit) {
+                               FuncRequest cmd(bv, LFUN_INSET_EDIT, "left");
+                               inset->localDispatch(cmd);
+                       }
                        if (gotsel && pastesel)
                                bv->owner()->dispatch(FuncRequest(LFUN_PASTESELECTION));
                }
@@ -416,7 +418,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
 
                for (; tmp != end; ++tmp) {
                        if (tmp->params().startOfAppendix()) {
-                               setUndo(bv, Undo::EDIT, tmp, boost::next(tmp));
+                               setUndo(bv, Undo::EDIT, tmp);
                                tmp->params().startOfAppendix(false);
                                int tmpy;
                                setHeightOfRow(getRow(tmp, 0, tmpy));
@@ -424,7 +426,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        }
                }
 
-               setUndo(bv, Undo::EDIT, pit, boost::next(pit));
+               setUndo(bv, Undo::EDIT, pit);
                pit->params().startOfAppendix(start);
 
                // we can set the refreshing parameters now
@@ -606,7 +608,8 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                    && isHighlyEditableInset(cursor.par()->getInset(cursor.pos()))) {
                        Inset * tmpinset = cursor.par()->getInset(cursor.pos());
                        cmd.message(tmpinset->editMessage());
-                       tmpinset->edit(bv, !is_rtl);
+                       FuncRequest cmd1(bv, LFUN_INSET_EDIT, is_rtl ? "right" : "left");
+                       tmpinset->localDispatch(cmd1);
                        break;
                }
                if (!is_rtl)
@@ -631,7 +634,8 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                    isHighlyEditableInset(cursor.par()->getInset(cursor.pos()))) {
                        Inset * tmpinset = cursor.par()->getInset(cursor.pos());
                        cmd.message(tmpinset->editMessage());
-                       tmpinset->edit(bv, is_rtl);
+                       FuncRequest cmd1(bv, LFUN_INSET_EDIT, is_rtl ? "left" : "right");
+                       tmpinset->localDispatch(cmd1);
                        break;
                }
                if (is_rtl)
@@ -926,12 +930,12 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                bv->switchKeyMap();
                break;
 
-       case LFUN_PROTECTEDSPACE:
+       case LFUN_SPACE_INSERT:
                if (cursor.par()->layout()->free_spacing) {
                        insertChar(' ');
                        update();
                } else {
-                       specialChar(this, bv, InsetSpecialChar::PROTECTED_SEPARATOR);
+                       doInsertInset(this, cmd, false, false);
                }
                moveCursorUpdate(bv, false);
                break;
@@ -1120,6 +1124,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                }
 
                bool change_layout = (current_layout != layout);
+
                if (!change_layout && selection.set() &&
                        selection.start.par() != selection.end.par())
                {
@@ -1133,6 +1138,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                                ++spit;
                        }
                }
+
                if (change_layout) {
                        current_layout = layout;
                        update();