Hi Przemek,

I have found an error in memo functions.

If line is exactly of nLineLength + 1 space + SOFTCR then error raises up.

Checked with clipper 5.2c

Try this:

#define HB_HARDCR               ( Chr( 13 ) + Chr( 10 ) )
#define HB_SOFTCR               ( Chr( 141 ) + Chr( 10 ) )

PROCEDURE Main()

  LOCAL cText
  LOCAL nLineLenght := 70

// this string has to be exactly of 70 chars + 1 space + SOFTCR + other chars cText := "LINE 1 - This is a line longer than line width, so it is splitted into " + HB_SOFTCR + ;
           "two lines" + HB_HARDCR

  ? MLPos( cText, nLineLenght, 2 ), "Should be 74"
  ? MLCToPos( cText, nLineLenght, 2, 0 ), "Should be 74"

  ? MemoLine( cText, nLineLenght, 1 )
  ? MemoLine( cText, nLineLenght, 2 )
  ? SubStr( cText, MLCToPos( cText, nLineLenght, 2, 0 ) )
  aPos := MPosToLC( cText, nLineLenght, 72 )
  ? "Line ", aPos[ 1 ], ", Col ", aPos[ 2 ], " (Should be 2, 0)"

RETURN


_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to