]> git.lyx.org Git - lyx.git/blobdiff - src/text2.C
update no.po
[lyx.git] / src / text2.C
index dea60ba4481406e99e5cb6d56c6af4fc00356138..a4592c79ce95685b2e809ba6452775bba85d109d 100644 (file)
@@ -45,7 +45,7 @@
 #include "support/textutils.h"
 #include "support/lstrings.h"
 
-#include <boost/format.hpp>
+#include "BoostFormat.h"
 
 using std::vector;
 using std::copy;
@@ -1039,33 +1039,29 @@ void LyXText::toggleFree(BufferView * bview,
 
 string LyXText::getStringToIndex(BufferView * bview)
 {
-       string idxstring;
-
        // Try implicit word selection
        // If there is a change in the language the implicit word selection
        // is disabled.
        LyXCursor const reset_cursor = cursor;
        bool const implicitSelection = selectWordWhenUnderCursor(bview, PREVIOUS_WORD);
 
-       if (!selection.set()) {
+       string idxstring;
+       if (!selection.set())
                bview->owner()->message(_("Nothing to index!"));
-               return string();
-       }
-       if (selection.start.par() != selection.end.par()) {
+       else if (selection.start.par() != selection.end.par())
                bview->owner()->message(_("Cannot index more than one paragraph!"));
-               return string();
-       }
+       else
+               idxstring = selectionAsString(bview->buffer(), false);
 
-       idxstring = selectionAsString(bview->buffer(), false);
+       // Reset cursors to their original position.
+       cursor = reset_cursor;
+       setCursor(bview, cursor.par(), cursor.pos());
+       selection.cursor = cursor;
 
-       // Implicit selections are cleared afterwards
-       //and cursor is set to the original position.
-       if (implicitSelection) {
+       // Clear the implicit selection.
+       if (implicitSelection)
                clearSelection();
-               cursor = reset_cursor;
-               setCursor(bview, cursor.par(), cursor.pos());
-               selection.cursor = cursor;
-       }
+
        return idxstring;
 }
 
@@ -1423,7 +1419,9 @@ void LyXText::copyEnvironmentType()
 
 void LyXText::pasteEnvironmentType(BufferView * bview)
 {
-       setLayout(bview, copylayouttype);
+       // do nothing if there has been no previous copyEnvironmentType()
+       if (!copylayouttype.empty())
+               setLayout(bview, copylayouttype);
 }