mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 22:17:41 +00:00
bug 1825 make sure that we do not return a pos that is not on the row
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10206 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c1ef1ac5e4
commit
8355663e97
@ -1,5 +1,10 @@
|
||||
2005-07-15 <lgb@tandberg.net>
|
||||
|
||||
* text.C (setCursorFromCoordinates): add a debug statement
|
||||
|
||||
* text2.C (getColumnNearX): bug 1825 make sure that we don't
|
||||
return a pos that is not on the row
|
||||
|
||||
* output_latex.C (TeXDeeper): get rid of potential dereferencing
|
||||
of past the end iterator
|
||||
|
||||
|
@ -2304,5 +2304,12 @@ void LyXText::setCursorFromCoordinates(LCursor & cur, int const x, int const y)
|
||||
bool bound = false;
|
||||
int xx = x;
|
||||
pos_type const pos = row.pos() + getColumnNearX(pit, row, xx, bound);
|
||||
|
||||
lyxerr[Debug::DEBUG]
|
||||
<< BOOST_CURRENT_FUNCTION
|
||||
<< ": setting cursor pit: " << pit
|
||||
<< " pos: " << pos
|
||||
<< endl;
|
||||
|
||||
setCursor(cur, pit, pos, true, bound);
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ using lyx::pos_type;
|
||||
using std::endl;
|
||||
using std::ostringstream;
|
||||
using std::string;
|
||||
using std::min;
|
||||
|
||||
|
||||
LyXText::LyXText(BufferView * bv)
|
||||
@ -854,7 +855,11 @@ pos_type LyXText::getColumnNearX(pit_type const pit,
|
||||
}
|
||||
|
||||
x = int(tmpx) + xo;
|
||||
return c - row.pos();
|
||||
|
||||
if (end == par.size())
|
||||
return c - row.pos();
|
||||
|
||||
return min(c - row.pos(), end - 1 - row.pos());
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user