diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 3f358425cb..9a159e1c90 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,9 @@ +2001-06-10 15:06 GMT+2 Maurilio Longo + * source/rtl/memoedit.prg + ! fixed error in handling of text (EOL delimiters handling was wrong) + * source/rtl/teditor.prg + ! fixed error in handling of text (EOL delimiters handling was wrong) + 2001-06-09 23:15 GMT-3 Horacio Roldan *source/rdd/dbf1.c ! fixed message sending that corrupted dbf (with ftp) header diff --git a/harbour/source/rtl/memoedit.prg b/harbour/source/rtl/memoedit.prg index 01ca386262..09b8279a51 100644 --- a/harbour/source/rtl/memoedit.prg +++ b/harbour/source/rtl/memoedit.prg @@ -244,9 +244,7 @@ FUNCTION MemoEdit(cString,; DEFAULT cString TO "" // Original MemoEdit() converts Tabs into spaces; - // TOFIX: I need to add an EOL char to fix the case where I call MemoEdit() with a string of one line without EOL. - // If I don't add an EOL I lose last char of string - oEd := TMemoEditor():New(StrTran(cString, Chr(K_TAB), Space(1)) + HB_OSNewLine(), nTop, nLeft, nBottom, nRight, lEditMode, nLineLength, nTabSize) + oEd := TMemoEditor():New(StrTran(cString, Chr(K_TAB), Space(1)), nTop, nLeft, nBottom, nRight, lEditMode, nLineLength, nTabSize) oEd:MemoInit(cUserFunction) oEd:RefreshWindow() diff --git a/harbour/source/rtl/teditor.prg b/harbour/source/rtl/teditor.prg index 0861145a8a..b2079bcb6c 100644 --- a/harbour/source/rtl/teditor.prg +++ b/harbour/source/rtl/teditor.prg @@ -176,9 +176,22 @@ STATIC function Text2Array(cString, nWordWrapCol) cEOL := WhichEOL(cString) nEOLLen := Len(cEOL) + // __StrTkPtr() needs that string to be tokenized be terminated with a token delimiter + if Rat(cEOL, cString) <> Len(cString) - nEOLLen + 1 + cString += cEOL + endif + nRetLen := 0 ncSLen := Len(cString) + // If cString starts with an EOL delimiter I have to add an empty line since __StrTkPtr + // gives back _next_ token and would skip this first EOL delimiter + if Left(cString, nEOLLen) == cEOL + AAdd(aArray, TTextLine():New(cLine, .F.)) + nTokPos += nEOLLen + nRetLen += nEOLLen + endif + while nRetLen < ncSLen /* TOFIX: Note that __StrToken is not able to cope with delimiters longer than one char */ // Dos - OS/2 - Windows have CRLF as EOL @@ -236,11 +249,14 @@ METHOD GetText() CLASS TEditor LOCAL cEOL := HB_OSNewLine() if ::lWordWrap - AEval(::aText, {|cItem| cString += cItem:cText + iif(cItem:lSoftCR, "", cEOL)}) + AEval(::aText, {|cItem| cString += cItem:cText + iif(cItem:lSoftCR, "", cEOL)},, ::naTextLen - 1) else - AEval(::aText, {|cItem| cString += cItem:cText + cEOL}) + AEval(::aText, {|cItem| cString += cItem:cText + cEOL},, ::naTextLen - 1) endif + // Last line does not need a cEOL delimiter + cString += ::aText[::naTextLen]:cText + return cString