mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
* bufferview_funcs.cpp:status(): use new TextMetrics::parPosition().
* TextMetrics::cursorNext(): compil fix. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20239 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fb82e23a44
commit
e6854f527f
@ -49,6 +49,7 @@ using std::make_pair;
|
||||
using std::max;
|
||||
using std::min;
|
||||
using std::endl;
|
||||
using std::pair;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
@ -153,6 +154,19 @@ ParagraphMetrics & TextMetrics::parMetrics(pit_type pit,
|
||||
}
|
||||
|
||||
|
||||
int TextMetrics::parPosition(pit_type pit) const
|
||||
{
|
||||
pair<pit_type, ParagraphMetrics> first = *par_metrics_.begin();
|
||||
pair<pit_type, ParagraphMetrics> last = *par_metrics_.rbegin();
|
||||
if (pit < first.first)
|
||||
return -1000000;
|
||||
else if (pit > last.first)
|
||||
return +1000000;
|
||||
|
||||
return par_metrics_[pit].position();
|
||||
}
|
||||
|
||||
|
||||
bool TextMetrics::metrics(MetricsInfo & mi, Dimension & dim)
|
||||
{
|
||||
BOOST_ASSERT(mi.base.textwidth);
|
||||
@ -1535,7 +1549,7 @@ void TextMetrics::cursorNext(Cursor & cur)
|
||||
|
||||
int x = cur.x_target();
|
||||
setCursorFromCoordinates(cur, x, cur.bv().workHeight() - 1);
|
||||
text_->dispatch(cur, FuncRequest(cur.selection()? LFUN_DOWN_SELECT: LFUN_DOWN));
|
||||
cur.dispatch(FuncRequest(cur.selection()? LFUN_DOWN_SELECT: LFUN_DOWN));
|
||||
|
||||
if (cpar == cur.pit() && cpos == cur.pos())
|
||||
// we have a row which is taller than the workarea. The
|
||||
|
@ -48,6 +48,8 @@ public:
|
||||
bool has(pit_type pit) const;
|
||||
///
|
||||
ParagraphMetrics const & parMetrics(pit_type) const;
|
||||
///
|
||||
int parPosition(pit_type pit) const;
|
||||
|
||||
///
|
||||
Dimension const & dimension() const;
|
||||
|
@ -247,18 +247,10 @@ CurStatus status(BufferView const * bv, DocIterator const & dit)
|
||||
{
|
||||
// FIXME: it's be better to have something like TextMetrics::status().
|
||||
TextMetrics const & tm = bv->textMetrics(dit.bottom().text());
|
||||
pit_type const pit = dit.bottom().pit();
|
||||
if (!tm.has(pit)) {
|
||||
if (dit.bottom().pit() < bv->anchor_ref())
|
||||
return CUR_ABOVE;
|
||||
else
|
||||
return CUR_BELOW;
|
||||
}
|
||||
|
||||
ParagraphMetrics const & pm = tm.parMetrics(pit);
|
||||
if (pm.position() < 0)
|
||||
int par_pos = tm.parPosition(dit.bottom().pit());
|
||||
if (par_pos < 0)
|
||||
return CUR_ABOVE;
|
||||
else if (pm.position() > bv->workHeight())
|
||||
else if (par_pos > bv->workHeight())
|
||||
return CUR_BELOW;
|
||||
|
||||
return CUR_INSIDE;
|
||||
|
Loading…
Reference in New Issue
Block a user