Fix line number alignment in Fl_Text_Display/Editor (STR #3363).

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12170 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser 2017-02-04 21:56:38 +00:00
parent cbc5a4842d
commit 759d2f1c99
2 changed files with 5 additions and 4 deletions

View File

@ -42,13 +42,14 @@ Changes in FLTK 1.4.0 Released: ??? ?? 2017
Other Improvements Other Improvements
- (add here) - (add new items here)
- Many documentation fixes, clarifications, and enhancements. - Many documentation fixes, clarifications, and enhancements.
Bug Fixes Bug Fixes
- (add here) - (add new items here)
- Fix line number alignment in Fl_Text_Display/Editor (STR #3363).
- Fix ignored buffer pre-allocation (requestedSize) in Fl_Text_Buffer. - Fix ignored buffer pre-allocation (requestedSize) in Fl_Text_Buffer.
See fltk.general "Fl_Text_Buffer constructor bug" on Dec 5, 2016. See fltk.general "Fl_Text_Buffer constructor bug" on Dec 5, 2016.
- Fix build with configure --enable-cairo --enable-cairoext, - Fix build with configure --enable-cairo --enable-cairoext,

View File

@ -2914,7 +2914,7 @@ void Fl_Text_Display::draw_line_numbers(bool /*clearAll*/) {
// Take scrollbars and positions into account. // Take scrollbars and positions into account.
int hscroll_h = mHScrollBar->visible() ? mHScrollBar->h() : 0; int hscroll_h = mHScrollBar->visible() ? mHScrollBar->h() : 0;
int xoff = Fl::box_dx(box()); int xoff = Fl::box_dx(box());
int yoff = Fl::box_dy(box()) + ((scrollbar_align()&FL_ALIGN_TOP)?hscroll_h:0); int yoff = text_area.y - y();
#ifndef LINENUM_LEFT_OF_VSCROLL #ifndef LINENUM_LEFT_OF_VSCROLL
int vscroll_w = mVScrollBar->visible() ? mVScrollBar->w() : 0; int vscroll_w = mVScrollBar->visible() ? mVScrollBar->w() : 0;
@ -2951,7 +2951,7 @@ void Fl_Text_Display::draw_line_numbers(bool /*clearAll*/) {
if (lineStart != -1 && (lineStart==0 || buffer()->char_at(lineStart-1)=='\n')) { if (lineStart != -1 && (lineStart==0 || buffer()->char_at(lineStart-1)=='\n')) {
sprintf(lineNumString, linenumber_format(), line); sprintf(lineNumString, linenumber_format(), line);
int xx = x() + xoff + 3, int xx = x() + xoff + 3,
yy = Y + 3, yy = Y,
ww = mLineNumWidth - (3*2), ww = mLineNumWidth - (3*2),
hh = lineHeight; hh = lineHeight;
fl_draw(lineNumString, xx, yy, ww, hh, linenumber_align(), 0, 0); fl_draw(lineNumString, xx, yy, ww, hh, linenumber_align(), 0, 0);