mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-30 05:12:40 +00:00
fix bugs 2321 and 2323
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13272 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7b0e52d4d4
commit
215476903e
@ -1,3 +1,14 @@
|
|||||||
|
2006-02-24 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||||
|
|
||||||
|
* text3.C (mathDispatch): fix crash when selection is not empty
|
||||||
|
but selectionAsString is empty (bug 2321).
|
||||||
|
|
||||||
|
2006-02-23 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||||
|
|
||||||
|
* text.C (changeCase): avoid crash in empty paragraph or on last
|
||||||
|
word of the paragraph. (buf 2323)
|
||||||
|
(cursorRightOneWord): fix the logic to stop at a beginning of a word.
|
||||||
|
|
||||||
2006-02-22 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
2006-02-22 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||||
|
|
||||||
* buffer.C (readHeader): also erase params.preamble in advance
|
* buffer.C (readHeader): also erase params.preamble in advance
|
||||||
|
10
src/text.C
10
src/text.C
@ -1326,13 +1326,12 @@ bool LyXText::cursorRightOneWord(LCursor & cur)
|
|||||||
++old.pit();
|
++old.pit();
|
||||||
old.pos() = 0;
|
old.pos() = 0;
|
||||||
} else {
|
} else {
|
||||||
// Skip through initial nonword stuff.
|
|
||||||
// Treat floats and insets as words.
|
|
||||||
while (old.pos() != old.lastpos() && !old.paragraph().isLetter(old.pos()))
|
|
||||||
++old.pos();
|
|
||||||
// Advance through word.
|
// Advance through word.
|
||||||
while (old.pos() != old.lastpos() && old.paragraph().isLetter(old.pos()))
|
while (old.pos() != old.lastpos() && old.paragraph().isLetter(old.pos()))
|
||||||
++old.pos();
|
++old.pos();
|
||||||
|
// Skip through trailing nonword stuff.
|
||||||
|
while (old.pos() != old.lastpos() && !old.paragraph().isLetter(old.pos()))
|
||||||
|
++old.pos();
|
||||||
}
|
}
|
||||||
return setCursor(cur, old.pit(), old.pos());
|
return setCursor(cur, old.pit(), old.pos());
|
||||||
}
|
}
|
||||||
@ -1349,7 +1348,6 @@ bool LyXText::cursorLeftOneWord(LCursor & cur)
|
|||||||
old.pos() = old.lastpos();
|
old.pos() = old.lastpos();
|
||||||
} else {
|
} else {
|
||||||
// Skip through initial nonword stuff.
|
// Skip through initial nonword stuff.
|
||||||
// Treat floats and insets as words.
|
|
||||||
while (old.pos() != 0 && !old.paragraph().isLetter(old.pos() - 1))
|
while (old.pos() != 0 && !old.paragraph().isLetter(old.pos() - 1))
|
||||||
--old.pos();
|
--old.pos();
|
||||||
// Advance through word.
|
// Advance through word.
|
||||||
@ -1495,7 +1493,7 @@ void LyXText::changeCase(LCursor & cur, LyXText::TextCase action)
|
|||||||
} else {
|
} else {
|
||||||
from = cur.top();
|
from = cur.top();
|
||||||
getWord(from, to, lyx::PARTIAL_WORD);
|
getWord(from, to, lyx::PARTIAL_WORD);
|
||||||
setCursor(cur, to.pit(), to.pos() + 1);
|
cursorRightOneWord(cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
recordUndoSelection(cur);
|
recordUndoSelection(cur);
|
||||||
|
@ -135,6 +135,9 @@ namespace {
|
|||||||
string sel = cur.selectionAsString(false);
|
string sel = cur.selectionAsString(false);
|
||||||
//lyxerr << "selection is: '" << sel << "'" << endl;
|
//lyxerr << "selection is: '" << sel << "'" << endl;
|
||||||
|
|
||||||
|
// It may happen that sel is empty but there is a selection
|
||||||
|
replaceSelection(cur);
|
||||||
|
|
||||||
if (sel.empty()) {
|
if (sel.empty()) {
|
||||||
const int old_pos = cur.pos();
|
const int old_pos = cur.pos();
|
||||||
cur.insert(new MathHullInset("simple"));
|
cur.insert(new MathHullInset("simple"));
|
||||||
@ -155,7 +158,6 @@ namespace {
|
|||||||
// create a macro if we see "\\newcommand"
|
// create a macro if we see "\\newcommand"
|
||||||
// somewhere, and an ordinary formula
|
// somewhere, and an ordinary formula
|
||||||
// otherwise
|
// otherwise
|
||||||
cutSelection(cur, true, true);
|
|
||||||
if (sel.find("\\newcommand") == string::npos
|
if (sel.find("\\newcommand") == string::npos
|
||||||
&& sel.find("\\def") == string::npos)
|
&& sel.find("\\def") == string::npos)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user