]> git.lyx.org Git - features.git/commitdiff
* src/Text.cpp (changeCase): do not set the selection if it was not
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 28 Jan 2008 10:50:24 +0000 (10:50 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 28 Jan 2008 10:50:24 +0000 (10:50 +0000)
already set.

* src/Paragraph.cpp (changeCase): make sure to update the selection
as needed.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22695 a592a061-630c-0410-9148-cb99ea01b6c8

src/Paragraph.cpp
src/Paragraph.h
src/Text.cpp

index 4f4d9ff5630454a6e255d9183443a39fdf8786b7..19a99cfe09683ad1d42bdb094bbb73bdf9e2a951 100644 (file)
@@ -991,13 +991,6 @@ void Paragraph::Private::validate(LaTeXFeatures & features,
 
        // then the layouts
        features.useLayout(layout.name());
-       if (!layout.requires().empty()) {
-               vector<string> req = layout.requires();
-               for (vector<string>::const_iterator it = req.begin();
-                    it != req.end(); ++it) {
-                       features.require(*it);
-               }
-       }
 
        // then the fonts
        fontlist_.validate(features);
@@ -2543,7 +2536,7 @@ Inset const * Paragraph::getInset(pos_type pos) const
 
 
 void Paragraph::changeCase(BufferParams const & bparams, pos_type pos,
-               pos_type right, TextCase action)
+               pos_type right, TextCase action)
 {
        // process sequences of modified characters; in change
        // tracking mode, this approach results in much better
index 3b9d4be36ff5b75e090f16e532327177443e481d..04ce3f4fbcc3a55e34a18f02ab4e9336ee523de9 100644 (file)
@@ -350,7 +350,7 @@ public:
 
        ///
        void changeCase(BufferParams const & bparams, pos_type pos,
-               pos_type right, TextCase action);
+               pos_type right, TextCase action);
 
        /// find \param str string inside Paragraph.
        /// \return true if the specified string is at the specified position
index 7b697e6fbc0bf866483236739e2dc4ed94404f81..6e2ee99964f6bd948eebc9a79c0a153e4c2ee72a 100644 (file)
@@ -823,9 +823,11 @@ void Text::changeCase(Cursor & cur, TextCase action)
        CursorSlice from;
        CursorSlice to;
 
+       bool gotsel = false;
        if (cur.selection()) {
                from = cur.selBegin();
                to = cur.selEnd();
+               gotsel = true;
        } else {
                from = cur.top();
                getWord(from, to, PARTIAL_WORD);
@@ -850,10 +852,13 @@ void Text::changeCase(Cursor & cur, TextCase action)
        }
 
        // the selection may have changed due to logically-only deleted chars
-       setCursor(cur, begPit, begPos);
-       cur.resetAnchor();
-       setCursor(cur, endPit, right);
-       cur.setSelection();
+       if (gotsel) {
+               setCursor(cur, begPit, begPos);
+               cur.resetAnchor();
+               setCursor(cur, endPit, right);
+               cur.setSelection();
+       } else
+               setCursor(cur, endPit, right);
 
        cur.checkBufferStructure();
 }