]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
Move OS specific code to proper place. Also make sure that no other
[lyx.git] / src / Text3.cpp
index a9b1e30f0961de7d3eaac352e0ac59856a05a0f6..b551f96397a37e3faef02e1ed2393494e2471235 100644 (file)
@@ -41,7 +41,6 @@
 #include "Lexer.h"
 #include "LyXRC.h"
 #include "Paragraph.h"
-#include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
 #include "TextClass.h"
 #include "TextMetrics.h"
@@ -389,10 +388,6 @@ static void outline(OutlineOp mode, Cursor & cur)
                        break;
        }
 
-       // Do we need to set insets' buffer_ members, because we copied
-       // some stuff? We'll assume we do and reset it otherwise.
-       bool set_buffers = true;
-
        switch (mode) {
                case OutlineUp: {
                        if (start == pars.begin())
@@ -416,10 +411,8 @@ static void outline(OutlineOp mode, Cursor & cur)
                        pit_type const len = distance(start, finish);
                        pit_type const deletepit = pit + len;
                        buf.undo().recordUndo(cur, ATOMIC_UNDO, newpit, deletepit - 1);
-                       pars.insert(dest, start, finish);
-                       start = boost::next(pars.begin(), deletepit);
-                       pit = newpit;
-                       pars.erase(start, finish);
+                       pars.splice(dest, start, finish);
+                       cur.pit() = newpit;
                        break;
                }
                case OutlineDown: {
@@ -437,12 +430,10 @@ static void outline(OutlineOp mode, Cursor & cur)
                        }
                        // One such was found:
                        pit_type newpit = distance(bgn, dest);
-                       pit_type const len = distance(start, finish);
                        buf.undo().recordUndo(cur, ATOMIC_UNDO, pit, newpit - 1);
-                       pars.insert(dest, start, finish);
-                       start = boost::next(bgn, pit);
-                       pit = newpit - len;
-                       pars.erase(start, finish);
+                       pit_type const len = distance(start, finish);
+                       pars.splice(dest, start, finish);
+                       cur.pit() = newpit - len;
                        break;
                }
                case OutlineIn: {
@@ -462,7 +453,6 @@ static void outline(OutlineOp mode, Cursor & cur)
                                        }
                                }
                        }
-                       set_buffers = false;
                        break;
                }
                case OutlineOut: {
@@ -482,20 +472,9 @@ static void outline(OutlineOp mode, Cursor & cur)
                                        }
                                }
                        }
-                       set_buffers = false;
                        break;
                }
        }
-       if (set_buffers)
-               // FIXME This only really needs doing for the newly introduced 
-               // paragraphs. Something like:
-               //      pit_type const numpars = distance(start, finish);
-               //      start = boost::next(bgn, pit);
-               //      finish = boost::next(start, numpars);
-               //      for (; start != finish; ++start)
-               //              start->setBuffer(buf);
-               // But while this seems to work, it is kind of fragile.
-               buf.inset().setBuffer(buf);
 }
 
 
@@ -555,7 +534,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                pit_type const pit = cur.pit();
                recUndo(cur, pit, pit + 1);
                cur.finishUndo();
-               swap(pars_[pit], pars_[pit + 1]);
+               pars_.swap(pit, pit + 1);
                cur.buffer()->updateLabels();
                needsUpdate = true;
                ++cur.pit();
@@ -566,7 +545,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                pit_type const pit = cur.pit();
                recUndo(cur, pit - 1, pit);
                cur.finishUndo();
-               swap(pars_[pit], pars_[pit - 1]);
+               pars_.swap(pit, pit - 1);
                cur.buffer()->updateLabels();
                --cur.pit();
                needsUpdate = true;
@@ -2147,10 +2126,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                break;
        }
 
-       if (lyxrc.spellcheck_continuously && cur.inTexted())
-               // Take this opportunity to spellcheck current word.
-               cur.paragraph().isMisspelled(cur.pos());
-
        needsUpdate |= (cur.pos() != cur.lastpos()) && cur.selection();
 
        // FIXME: The cursor flag is reset two lines below