bug 2298: cursorTop/Bottom/Home/End does not redraw after dEPM

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@13396 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2006-03-16 14:27:47 +00:00
parent d1bf49434e
commit 4a6095fe7e
7 changed files with 42 additions and 24 deletions

View File

@ -1,3 +1,11 @@
2006-03-16 Félix-Antoine Bourbonnais <bouf10pub2@myriade.ca>
* text3.C (dispatch): set needsUpdate according to the return
value of the methods below (bug 2298)
* text2.C (cursorTop, cursorBottom, cursorHome, cursorEnd): return
true if dEPM triggered.
2006-03-16 Jürgen Spitzmüller <j.spitzmueller@gmx.de> 2006-03-16 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* text.C (getPossibleLabel): get a sensible prefix inside figure and * text.C (getPossibleLabel): get a sensible prefix inside figure and

View File

@ -62,7 +62,8 @@ QWorkArea::QWorkArea(LyXView &, int, int)
content_->show(); content_->show();
content_->setBackgroundColor(lcolorcache.get(LColor::background)); // It is said that this helps reduce flicker
content_->setBackgroundMode(NoBackground);
QHBoxLayout * vl = new QHBoxLayout(this); QHBoxLayout * vl = new QHBoxLayout(this);
vl->addWidget(content_, 5); vl->addWidget(content_, 5);

View File

@ -748,9 +748,15 @@ int InsetGraphics::latex(Buffer const & buf, ostream & os,
string after; string after;
// Do we want subcaptions? // Do we want subcaptions?
if (params().subcaption) { if (params().subcaption) {
if (runparams.moving_arg)
before += "\\protect";
before += "\\subfigure[" + params().subcaptionText + "]{"; before += "\\subfigure[" + params().subcaptionText + "]{";
after = '}'; after = '}';
} }
if (runparams.moving_arg)
before += "\\protect";
// We never use the starred form, we use the "clip" option instead. // We never use the starred form, we use the "clip" option instead.
before += "\\includegraphics"; before += "\\includegraphics";

View File

@ -209,17 +209,17 @@ public:
/// ///
bool cursorDownParagraph(LCursor & cur); bool cursorDownParagraph(LCursor & cur);
/// ///
void cursorHome(LCursor & cur); bool cursorHome(LCursor & cur);
/// ///
void cursorEnd(LCursor & cur); bool cursorEnd(LCursor & cur);
/// ///
bool cursorPrevious(LCursor & cur); bool cursorPrevious(LCursor & cur);
/// ///
bool cursorNext(LCursor & cur); bool cursorNext(LCursor & cur);
/// ///
void cursorTop(LCursor & cur); bool cursorTop(LCursor & cur);
/// ///
void cursorBottom(LCursor & cur); bool cursorBottom(LCursor & cur);
/// ///
bool Delete(LCursor & cur); bool Delete(LCursor & cur);
/// ///

View File

@ -476,16 +476,16 @@ void LyXText::setFont(LCursor & cur, LyXFont const & font, bool toggleall)
// the cursor set functions have a special mechanism. When they // the cursor set functions have a special mechanism. When they
// realize you left an empty paragraph, they will delete it. // realize you left an empty paragraph, they will delete it.
void LyXText::cursorHome(LCursor & cur) bool LyXText::cursorHome(LCursor & cur)
{ {
BOOST_ASSERT(this == cur.text()); BOOST_ASSERT(this == cur.text());
Row const & row = cur.paragraph().getRow(cur.pos(),cur.boundary()); Row const & row = cur.paragraph().getRow(cur.pos(),cur.boundary());
setCursor(cur, cur.pit(), row.pos()); return setCursor(cur, cur.pit(), row.pos());
} }
void LyXText::cursorEnd(LCursor & cur) bool LyXText::cursorEnd(LCursor & cur)
{ {
BOOST_ASSERT(this == cur.text()); BOOST_ASSERT(this == cur.text());
// if not on the last row of the par, put the cursor before // if not on the last row of the par, put the cursor before
@ -494,7 +494,7 @@ void LyXText::cursorEnd(LCursor & cur)
pos_type end = cur.textRow().endpos(); pos_type end = cur.textRow().endpos();
if (end == 0) if (end == 0)
// empty text, end-1 is no valid position // empty text, end-1 is no valid position
return; return false;
bool boundary = false; bool boundary = false;
if (end != cur.lastpos()) { if (end != cur.lastpos()) {
if (!cur.paragraph().isLineSeparator(end-1) if (!cur.paragraph().isLineSeparator(end-1)
@ -503,21 +503,21 @@ void LyXText::cursorEnd(LCursor & cur)
else else
--end; --end;
} }
setCursor(cur, cur.pit(), end, true, boundary); return setCursor(cur, cur.pit(), end, true, boundary);
} }
void LyXText::cursorTop(LCursor & cur) bool LyXText::cursorTop(LCursor & cur)
{ {
BOOST_ASSERT(this == cur.text()); BOOST_ASSERT(this == cur.text());
setCursor(cur, 0, 0); return setCursor(cur, 0, 0);
} }
void LyXText::cursorBottom(LCursor & cur) bool LyXText::cursorBottom(LCursor & cur)
{ {
BOOST_ASSERT(this == cur.text()); BOOST_ASSERT(this == cur.text());
setCursor(cur, cur.lastpit(), boost::prior(paragraphs().end())->size()); return setCursor(cur, cur.lastpit(), boost::prior(paragraphs().end())->size());
} }

View File

@ -387,7 +387,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
if (cur.depth() == 1) { if (cur.depth() == 1) {
if (!cur.mark()) if (!cur.mark())
cur.clearSelection(); cur.clearSelection();
cursorTop(cur); needsUpdate = cursorTop(cur);
finishChange(cur, false); finishChange(cur, false);
} else { } else {
cur.undispatched(); cur.undispatched();
@ -398,7 +398,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
if (cur.depth() == 1) { if (cur.depth() == 1) {
if (!cur.selection()) if (!cur.selection())
cur.resetAnchor(); cur.resetAnchor();
cursorTop(cur); needsUpdate = cursorTop(cur);
finishChange(cur, true); finishChange(cur, true);
} else { } else {
cur.undispatched(); cur.undispatched();
@ -409,7 +409,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
if (cur.depth() == 1) { if (cur.depth() == 1) {
if (!cur.mark()) if (!cur.mark())
cur.clearSelection(); cur.clearSelection();
cursorBottom(cur); needsUpdate = cursorBottom(cur);
finishChange(cur, false); finishChange(cur, false);
} else { } else {
cur.undispatched(); cur.undispatched();
@ -420,7 +420,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
if (cur.depth() == 1) { if (cur.depth() == 1) {
if (!cur.selection()) if (!cur.selection())
cur.resetAnchor(); cur.resetAnchor();
cursorBottom(cur); needsUpdate = cursorBottom(cur);
finishChange(cur, true); finishChange(cur, true);
} else { } else {
cur.undispatched(); cur.undispatched();
@ -520,7 +520,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
update(cur); update(cur);
if (!cur.selection()) if (!cur.selection())
cur.resetAnchor(); cur.resetAnchor();
cursorPrevious(cur); needsUpdate = cursorPrevious(cur);
finishChange(cur, true); finishChange(cur, true);
break; break;
@ -528,7 +528,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
update(cur); update(cur);
if (!cur.selection()) if (!cur.selection())
cur.resetAnchor(); cur.resetAnchor();
cursorNext(cur); needsUpdate = cursorNext(cur);
finishChange(cur, true); finishChange(cur, true);
break; break;
@ -536,7 +536,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
update(cur); update(cur);
if (!cur.selection()) if (!cur.selection())
cur.resetAnchor(); cur.resetAnchor();
cursorHome(cur); needsUpdate = cursorHome(cur);
finishChange(cur, true); finishChange(cur, true);
break; break;
@ -544,7 +544,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
update(cur); update(cur);
if (!cur.selection()) if (!cur.selection())
cur.resetAnchor(); cur.resetAnchor();
cursorEnd(cur); needsUpdate = cursorEnd(cur);
finishChange(cur, true); finishChange(cur, true);
break; break;
@ -604,14 +604,14 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
case LFUN_HOME: case LFUN_HOME:
if (!cur.mark()) if (!cur.mark())
cur.clearSelection(); cur.clearSelection();
cursorHome(cur); needsUpdate = cursorHome(cur);
finishChange(cur, false); finishChange(cur, false);
break; break;
case LFUN_END: case LFUN_END:
if (!cur.mark()) if (!cur.mark())
cur.clearSelection(); cur.clearSelection();
cursorEnd(cur); needsUpdate = cursorEnd(cur);
finishChange(cur, false); finishChange(cur, false);
break; break;

View File

@ -54,6 +54,9 @@ What's new
- Fix cursor positioning in tabulars (bug 2006). - Fix cursor positioning in tabulars (bug 2006).
- Update screen when cursor was between two spaces and goes to
line/document start/end (bug 2298).
- Fix drawing of inset buttons (bug 2328) - Fix drawing of inset buttons (bug 2328)
- Fix drawing of \boxed and \fbox in formulas (bug 2361). - Fix drawing of \boxed and \fbox in formulas (bug 2361).