]> git.lyx.org Git - features.git/commitdiff
fix indexing first word in a list layout
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 12 Sep 2001 10:41:25 +0000 (10:41 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 12 Sep 2001 10:41:25 +0000 (10:41 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2738 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/ChangeLog
src/lyxfind.C
src/lyxtext.h
src/mathed/ChangeLog
src/mathed/formulabase.C
src/paragraph.C
src/paragraph.h
src/text2.C

index 72c561185598a152eec7ec92061d7c6434f425d0..eb645466b8a2e6c45f49929f3eac1efa38be1715 100644 (file)
@@ -3071,13 +3071,14 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                string arg = argument;
 
                if (arg.empty()) {
-                       arg = bv_->getLyXText()->selectionAsString(buffer_);
+                       arg = bv_->getLyXText()->selectionAsString(buffer_,
+                                                                  false);
  
                        // FIXME
                        if (arg.size() > 100 || arg.empty()) {
                                // Get word or selection
                                bv_->getLyXText()->selectWordWhenUnderCursor(bv_, LyXText::WHOLE_WORD);
-                               arg = bv_->getLyXText()->selectionAsString(buffer_);
+                               arg = bv_->getLyXText()->selectionAsString(buffer_, false);
                                // FIXME: where is getLyXText()->unselect(bv_) ?
                        }
                }
index cab3736be8b337d1c529aa98029d4c23a13570a2..1fc3c5df70ed2f7677f4e048c2811b7bb87f9561 100644 (file)
@@ -1,3 +1,16 @@
+2001-09-12  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * text2.C (copySelection): 
+       (cutSelection): 
+       * lyxfind.C (LyXReplace): 
+       * BufferView_pimpl.C (Dispatch): pass the correct flag to
+       LyXText::selectionAsString. 
+
+       * paragraph.C (asString): add "label" argument to the second form
+
+       * text2.C (selectionAsString): add "label" argument and pass it to
+       Paragraph::asString. 
+
 2001-09-10  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * lyx_main.C (commandLineHelp): remove version information
index 7174e5ca646042ac9a6ee16823d4513aac2efafd..e5d0f75afbc6eb18d592aeb27ad6b1153d604f2f 100644 (file)
@@ -80,10 +80,10 @@ int LyXReplace(BufferView * bv,
        string str2;
        if (casesens) {
                str1 = searchstr;
-               str2 = text->selectionAsString(bv->buffer());
+               str2 = text->selectionAsString(bv->buffer(), false);
        } else {
                str1 = lowercase(searchstr);
-               str2 = lowercase(text->selectionAsString(bv->buffer()));
+               str2 = lowercase(text->selectionAsString(bv->buffer(), false));
        }
        if (str1 != str2) {
                if (!LyXFind(bv, searchstr, fw, false, casesens, matchwrd) ||
index 08e22dde7a7b9cd00bff427497b818f6a4e02e9e..8e35b20d518104ad3ea0fece4d3b04b5a80adaa2 100644 (file)
@@ -280,7 +280,7 @@ public:
        ///
        void clearSelection() const;
        ///
-       string const selectionAsString(Buffer const *) const;
+       string const selectionAsString(Buffer const *, bool label) const;
        
        /// select the word we need depending on word_location
        void getWord(LyXCursor & from, LyXCursor & to, 
index ec3bde91da05bde37f7571b05b661c51cb55733d..6e8f8a3688d5977f26685d7f36b8110306404a37 100644 (file)
@@ -1,3 +1,8 @@
+2001-09-12  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * formulabase.C (mathDispatchCreation): pass second argument
+       'false' (no label) to selectionAsString
+
 2001-09-11  André Pönitz  <poenitz@gmx.net>
 
        * math_atom.[Ch]: new basic item in the MathArray
index 9e950a79420dc6631cc0404d61fd210fe8486bdf..ab62ccb72cd4fbf57868e49ea7108e00695a3214 100644 (file)
@@ -732,7 +732,8 @@ void mathDispatchCreation(BufferView * bv, string const & arg, bool display)
                //      sel = "";
                //else
 
-               string sel = bv->getLyXText()->selectionAsString(bv->buffer());
+               string sel = bv->getLyXText()->selectionAsString(bv->buffer(),
+                                                                false);
 
                InsetFormulaBase * f;
                if (sel.empty()) {
index 80745161f20150c9eccb35ee135df76fd12affe2..91b7cad91abbac161cc528eec26b4d7576ec16c6 100644 (file)
@@ -1930,12 +1930,13 @@ string const Paragraph::asString(Buffer const * buffer, bool label)
 
 
 string const Paragraph::asString(Buffer const * buffer, 
-                           Paragraph::size_type beg,
-                           Paragraph::size_type end)
+                                Paragraph::size_type beg,
+                                Paragraph::size_type end,
+                                bool label)
 {
        ostringstream ost;
 
-       if (beg == 0 && !params().labelString().empty())
+       if (beg == 0 && label && !params().labelString().empty())
                ost << params().labelString() << ' ';
 
        for (Paragraph::size_type i = beg; i < end; ++i) {
index 1b54a1df1a0b858b7c5803c8d8d9995652b7ab5b..0b4ba210e805f5d0a091f54ce084d2200ec31a17 100644 (file)
@@ -111,7 +111,8 @@ public:
 
        string const asString(Buffer const *, bool label);
        ///
-       string const asString(Buffer const *, size_type beg, size_type end);
+       string const asString(Buffer const *, size_type beg, size_type end,
+                             bool label);
        
        ///
        void writeFile(Buffer const *, std::ostream &, BufferParams const &,
index 78be2366657e17e677595970d3e17b4fa70b2949..526f671a7b7d5e5133b7e858738f1becfd255810 100644 (file)
@@ -1013,7 +1013,8 @@ void LyXText::setSelection(BufferView * bview)
 }
 
 
-string const LyXText::selectionAsString(Buffer const * buffer) const
+string const LyXText::selectionAsString(Buffer const * buffer,
+                                       bool label) const
 {
        if (!selection.set()) return string();
        string result;
@@ -1022,7 +1023,8 @@ string const LyXText::selectionAsString(Buffer const * buffer) const
        if (selection.start.par() == selection.end.par()) {
                result += selection.start.par()->asString(buffer,
                                                          selection.start.pos(),
-                                                         selection.end.pos());
+                                                         selection.end.pos(),
+                                                         label);
                return result;
        }
        
@@ -1031,7 +1033,8 @@ string const LyXText::selectionAsString(Buffer const * buffer) const
        // First paragraph in selection
        result += selection.start.par()->asString(buffer,
                                                  selection.start.pos(),
-                                                 selection.start.par()->size())
+                                                 selection.start.par()->size(),
+                                                 label)
                + "\n\n";
        
        // The paragraphs in between (if any)
@@ -1039,13 +1042,14 @@ string const LyXText::selectionAsString(Buffer const * buffer) const
        tmpcur.par(tmpcur.par()->next());
        while (tmpcur.par() != selection.end.par()) {
                result += tmpcur.par()->asString(buffer, 0,
-                                                tmpcur.par()->size()) +"\n\n";
+                                                tmpcur.par()->size(),
+                                                label) + "\n\n";
                tmpcur.par(tmpcur.par()->next());
        }
 
        // Last paragraph in selection
        result += selection.end.par()->asString(buffer, 0,
-                                               selection.end.pos());
+                                               selection.end.pos(), label);
        
        return result;
 }
@@ -1153,7 +1157,7 @@ LyXText::getStringToIndex(BufferView * bview)
                return string();
        }
 
-       idxstring = selectionAsString(bview->buffer());
+       idxstring = selectionAsString(bview->buffer(), false);
        
        // Implicit selections are cleared afterwards
        //and cursor is set to the original position.
@@ -1723,7 +1727,7 @@ void LyXText::cutSelection(BufferView * bview, bool doclear, bool realcut)
        // finished. The solution used currently just works, to make it
        // faster we need to be more clever and probably also have more
        // calls to stuffClipboard. (Lgb)
-       bview->stuffClipboard(selectionAsString(bview->buffer()));
+       bview->stuffClipboard(selectionAsString(bview->buffer(), true));
 
        // This doesn't make sense, if there is no selection
        if (!selection.set())
@@ -1802,7 +1806,7 @@ void LyXText::copySelection(BufferView * bview)
        // finished. The solution used currently just works, to make it
        // faster we need to be more clever and probably also have more
        // calls to stuffClipboard. (Lgb)
-       bview->stuffClipboard(selectionAsString(bview->buffer()));
+       bview->stuffClipboard(selectionAsString(bview->buffer(), true));
 
        // this doesnt make sense, if there is no selection
        if (!selection.set())