]> git.lyx.org Git - features.git/commitdiff
Fix bug #3821 by allowing insertStringAs* to reset the cursor.
authorRichard Heck <rgheck@comcast.net>
Sat, 24 Sep 2011 18:21:41 +0000 (18:21 +0000)
committerRichard Heck <rgheck@comcast.net>
Sat, 24 Sep 2011 18:21:41 +0000 (18:21 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39752 a592a061-630c-0410-9148-cb99ea01b6c8

src/CutAndPaste.cpp
src/Text.cpp
src/Text.h

index 0d70c2fb47cee86f3e84483d7a07acb8570993da..b9e6bd41cec8c0b52252aea6c1365771dced434e 100644 (file)
@@ -1045,6 +1045,7 @@ void pasteClipboardText(Cursor & cur, ErrorList & errorList, bool asParagraphs)
                cur.text()->insertStringAsParagraphs(cur, text, cur.current_font);
        else
                cur.text()->insertStringAsLines(cur, text, cur.current_font);
+       cur.setSelection();
 }
 
 
index 8996a795d1af67c9fc36790ab247c9b77112d3d1..88a1a4628020bbac09a6a79dd4f1f72cb5836505 100644 (file)
@@ -755,12 +755,12 @@ void Text::breakParagraph(Cursor & cur, bool inverse_logic)
 
 
 // needed to insert the selection
-void Text::insertStringAsLines(DocIterator const & dit, docstring const & str,
+void Text::insertStringAsLines(Cursor & cur, docstring const & str,
                Font const & font)
 {
        BufferParams const & bparams = owner_->buffer().params();
-       pit_type pit = dit.pit();
-       pos_type pos = dit.pos();
+       pit_type pit = cur.pit();
+       pos_type pos = cur.pos();
 
        // insert the string, don't insert doublespace
        bool space_inserted = true;
@@ -802,12 +802,13 @@ void Text::insertStringAsLines(DocIterator const & dit, docstring const & str,
                        space_inserted = (*cit == ' ');
                }
        }
+       setCursor(cur, pit, pos);
 }
 
 
 // turn double CR to single CR, others are converted into one
 // blank. Then insertStringAsLines is called
-void Text::insertStringAsParagraphs(DocIterator const & dit, docstring const & str,
+void Text::insertStringAsParagraphs(Cursor & cur, docstring const & str,
                Font const & font)
 {
        docstring linestr = str;
@@ -829,7 +830,7 @@ void Text::insertStringAsParagraphs(DocIterator const & dit, docstring const & s
                        newline_inserted = false;
                }
        }
-       insertStringAsLines(dit, linestr, font);
+       insertStringAsLines(cur, linestr, font);
 }
 
 
index f4110e260f5fe820ab2a56de19d862fafd3a4d18..60b6130cc4f2ea067d156ad2ec736ef88bc4196c 100644 (file)
@@ -263,10 +263,10 @@ public:
        /* these things are for search and replace */
 
        /// needed to insert the selection
-       void insertStringAsLines(DocIterator const & dit, docstring const & str,
+       void insertStringAsLines(Cursor & cur, docstring const & str,
                Font const & font);
        /// needed to insert the selection
-       void insertStringAsParagraphs(DocIterator const & dit, docstring const & str,
+       void insertStringAsParagraphs(Cursor & cur, docstring const & str,
                Font const & font);
 
        /// access to our paragraphs