mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 22:41:09 +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>
|
||||
|
||||
* 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.pos() = 0;
|
||||
} 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.
|
||||
while (old.pos() != old.lastpos() && old.paragraph().isLetter(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());
|
||||
}
|
||||
@ -1349,7 +1348,6 @@ bool LyXText::cursorLeftOneWord(LCursor & cur)
|
||||
old.pos() = old.lastpos();
|
||||
} else {
|
||||
// Skip through initial nonword stuff.
|
||||
// Treat floats and insets as words.
|
||||
while (old.pos() != 0 && !old.paragraph().isLetter(old.pos() - 1))
|
||||
--old.pos();
|
||||
// Advance through word.
|
||||
@ -1495,7 +1493,7 @@ void LyXText::changeCase(LCursor & cur, LyXText::TextCase action)
|
||||
} else {
|
||||
from = cur.top();
|
||||
getWord(from, to, lyx::PARTIAL_WORD);
|
||||
setCursor(cur, to.pit(), to.pos() + 1);
|
||||
cursorRightOneWord(cur);
|
||||
}
|
||||
|
||||
recordUndoSelection(cur);
|
||||
|
@ -135,6 +135,9 @@ namespace {
|
||||
string sel = cur.selectionAsString(false);
|
||||
//lyxerr << "selection is: '" << sel << "'" << endl;
|
||||
|
||||
// It may happen that sel is empty but there is a selection
|
||||
replaceSelection(cur);
|
||||
|
||||
if (sel.empty()) {
|
||||
const int old_pos = cur.pos();
|
||||
cur.insert(new MathHullInset("simple"));
|
||||
@ -155,7 +158,6 @@ namespace {
|
||||
// create a macro if we see "\\newcommand"
|
||||
// somewhere, and an ordinary formula
|
||||
// otherwise
|
||||
cutSelection(cur, true, true);
|
||||
if (sel.find("\\newcommand") == string::npos
|
||||
&& sel.find("\\def") == string::npos)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user