fix cursor movement with boundary

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10252 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2005-07-16 16:34:54 +00:00
parent ebfa2efab3
commit 868ab452a5
3 changed files with 25 additions and 5 deletions

View File

@ -1,3 +1,11 @@
2005-07-16 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* text3.C (dispatch): honor boundary when checking if a cursor
movement has been done
* text2.C (cursorRight, cursorLeft, cursorUp, cursorDown)
(setCursor, setCursorIntern): fix cursor movement with boundary
2005-07-16 Juergen Vigna <jug@lyx.org>
* text.C (currentState): output the actual Boundary

View File

@ -660,7 +660,6 @@ bool LyXText::setCursor(LCursor & cur, pit_type par, pos_type pos,
{
LCursor old = cur;
setCursorIntern(cur, par, pos, setfont, boundary);
cur.boundary(boundary);
return deleteEmptyParagraphMechanism(cur, old);
}
@ -693,6 +692,7 @@ void LyXText::setCursor(CursorSlice & cur, pit_type par,
void LyXText::setCursorIntern(LCursor & cur,
pit_type par, pos_type pos, bool setfont, bool boundary)
{
cur.boundary(boundary);
setCursor(cur.top(), par, pos, boundary);
cur.setTargetX();
if (setfont)
@ -1000,7 +1000,7 @@ bool LyXText::cursorLeft(LCursor & cur)
bool LyXText::cursorRight(LCursor & cur)
{
if (false && cur.boundary()) {
if (cur.boundary()) {
return setCursor(cur, cur.pit(), cur.pos(), true, false);
}
@ -1024,9 +1024,14 @@ bool LyXText::cursorRight(LCursor & cur)
bool LyXText::cursorUp(LCursor & cur)
{
Paragraph const & par = cur.paragraph();
int const row = par.pos2row(cur.pos());
int row;
int const x = cur.targetX();
if (cur.pos() && cur.boundary())
row = par.pos2row(cur.pos()-1);
else
row = par.pos2row(cur.pos());
if (!cur.selection()) {
int const y = bv_funcs::getPos(cur, cur.boundary()).y_;
LCursor old = cur;
@ -1063,9 +1068,14 @@ bool LyXText::cursorUp(LCursor & cur)
bool LyXText::cursorDown(LCursor & cur)
{
Paragraph const & par = cur.paragraph();
int const row = par.pos2row(cur.pos());
int row;
int const x = cur.targetX();
if (cur.pos() && cur.boundary())
row = par.pos2row(cur.pos()-1);
else
row = par.pos2row(cur.pos());
if (!cur.selection()) {
int const y = bv_funcs::getPos(cur, cur.boundary()).y_;
LCursor old = cur;

View File

@ -292,6 +292,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
BOOST_ASSERT(cur.text() == this);
BufferView * bv = &cur.bv();
CursorSlice oldTopSlice = cur.top();
bool oldBoundary = cur.boundary();
bool sel = cur.selection();
bool needsUpdate = !lyxaction.funcHasFlag(cmd.action, LyXAction::NoUpdate);
@ -413,7 +414,8 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
needsUpdate = cursorLeft(cur);
else
needsUpdate = cursorRight(cur);
if (!needsUpdate && oldTopSlice == cur.top()) {
if (!needsUpdate && oldTopSlice == cur.top() && cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
}