From b6bd386231b9c8a385f1402bed44514f8dc02ffa Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Mon, 5 Dec 2016 17:03:29 +0000 Subject: Fl_Text_Buffer constructor: fix "requestedSize ignored in mGapEnd". mGapEnd should reflect the total allocated size after the constructor is executed, i.e. the text buffer is empty. This was not the case. See thread "Fl_Text_Buffer constructor bug" (2016-12-05) in fltk.general. The bug was harmless, but the pre-allocation did not work as expected, i.e. the pre-allocated buffer size was allocated but effectively ignored later. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12134 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Text_Buffer.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Fl_Text_Buffer.cxx') diff --git a/src/Fl_Text_Buffer.cxx b/src/Fl_Text_Buffer.cxx index c4a935a81..9efcd6609 100644 --- a/src/Fl_Text_Buffer.cxx +++ b/src/Fl_Text_Buffer.cxx @@ -108,7 +108,7 @@ Fl_Text_Buffer::Fl_Text_Buffer(int requestedSize, int preferredGapSize) mPreferredGapSize = preferredGapSize; mBuf = (char *) malloc(requestedSize + mPreferredGapSize); mGapStart = 0; - mGapEnd = mPreferredGapSize; + mGapEnd = requestedSize + mPreferredGapSize; mTabDist = 8; mPrimary.mSelected = 0; mPrimary.mStart = mPrimary.mEnd = 0; @@ -1421,7 +1421,7 @@ void Fl_Text_Buffer::reallocate_with_gap(int newGapStart, int newGapLen) mBuf = newBuf; mGapStart = newGapStart; mGapEnd = newGapEnd; - } +} /* -- cgit v1.2.3