Fix PageUp/Down select when at the top/bottom of a document.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23510 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-03-06 12:41:38 +00:00
parent 3ba3389ede
commit 5a9653203f
3 changed files with 34 additions and 0 deletions

View File

@ -312,6 +312,18 @@ int BufferView::leftMargin() const
}
bool BufferView::isTopScreen() const
{
return d->scrollbarParameters_.position == d->scrollbarParameters_.min;
}
bool BufferView::isBottomScreen() const
{
return d->scrollbarParameters_.position == d->scrollbarParameters_.max;
}
Intl & BufferView::getIntl()
{
return d->intl_;

View File

@ -96,6 +96,12 @@ public:
/// left margin
int leftMargin() const;
/// \return true if the BufferView is at the top of the document.
bool isTopScreen() const;
/// \return true if the BufferView is at the bottom of the document.
bool isBottomScreen() const;
/// perform pending metrics updates.
/** \c Update::FitCursor means first to do a FitCursor, and to
* force an update if screen position changes.

View File

@ -1613,6 +1613,14 @@ int TextMetrics::cursorY(CursorSlice const & sl, bool boundary) const
void TextMetrics::cursorPrevious(Cursor & cur)
{
if (bv_->isTopScreen()) {
lyx::dispatch(FuncRequest(cur.selection()
? LFUN_BUFFER_BEGIN_SELECT : LFUN_BUFFER_BEGIN));
cur.finishUndo();
cur.updateFlags(Update::None);
return;
}
pos_type cpos = cur.pos();
pit_type cpar = cur.pit();
@ -1638,6 +1646,14 @@ void TextMetrics::cursorPrevious(Cursor & cur)
void TextMetrics::cursorNext(Cursor & cur)
{
if (bv_->isBottomScreen()) {
lyx::dispatch(FuncRequest(cur.selection()
? LFUN_BUFFER_END_SELECT : LFUN_BUFFER_END));
cur.finishUndo();
cur.updateFlags(Update::None);
return;
}
pos_type cpos = cur.pos();
pit_type cpar = cur.pit();