Fixes Fl_Text_Display line number calculation. (#1088)
This commit is contained in:
parent
6ea450407b
commit
737137cf78
@ -572,7 +572,10 @@ protected:
|
|||||||
int mCursorPreferredXPos; /* Pixel position for vert. cursor movement */
|
int mCursorPreferredXPos; /* Pixel position for vert. cursor movement */
|
||||||
int mNVisibleLines; /* # of visible (displayed) lines. This is
|
int mNVisibleLines; /* # of visible (displayed) lines. This is
|
||||||
also the size of the mLineStarts[] array. */
|
also the size of the mLineStarts[] array. */
|
||||||
int mNBufferLines; /* # of newlines in the buffer */
|
int mNBufferLines; /* # of newlines in the buffer, or number of
|
||||||
|
wraps if line wrapping is enabled. Note that
|
||||||
|
partial lines at the end of the buffer are
|
||||||
|
not counted, so you may want to add 1. */
|
||||||
Fl_Text_Buffer* mBuffer; /* Contains text to be displayed */
|
Fl_Text_Buffer* mBuffer; /* Contains text to be displayed */
|
||||||
Fl_Text_Buffer* mStyleBuffer; /* Optional parallel buffer containing
|
Fl_Text_Buffer* mStyleBuffer; /* Optional parallel buffer containing
|
||||||
color and font information */
|
color and font information */
|
||||||
|
@ -702,7 +702,7 @@ void Fl_Text_Display::recalc_display() {
|
|||||||
scroll_(mTopLineNumHint, mHorizOffsetHint);
|
scroll_(mTopLineNumHint, mHorizOffsetHint);
|
||||||
|
|
||||||
// everything will fit in the viewport
|
// everything will fit in the viewport
|
||||||
if (mNBufferLines < mNVisibleLines || mBuffer == NULL || mBuffer->length() == 0) {
|
if ((mNBufferLines+1 < mNVisibleLines) || (mBuffer == NULL) || (mBuffer->length() == 0)) {
|
||||||
scroll_(1, mHorizOffset);
|
scroll_(1, mHorizOffset);
|
||||||
/* if empty lines become visible, there may be an opportunity to
|
/* if empty lines become visible, there may be an opportunity to
|
||||||
display more text by scrolling down */
|
display more text by scrolling down */
|
||||||
|
Loading…
Reference in New Issue
Block a user