* src/Text.cpp (changeCase): do not set the selection if it was not

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
This commit is contained in:
Jean-Marc Lasgouttes 2008-01-28 10:50:24 +00:00
parent 1ac3d1b132
commit 21ff30cc38
3 changed files with 11 additions and 13 deletions

View 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

View 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

View 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
if (gotsel) {
setCursor(cur, begPit, begPos);
cur.resetAnchor();
setCursor(cur, endPit, right);
cur.setSelection();
} else
setCursor(cur, endPit, right);
cur.checkBufferStructure();
}